Skip to content
SS
Sunny Sahsi
Back to Projects
Featured Projectcompleted

CareRing

Privacy-first real-time family location intelligence, safety, and emergency response platform with sub-50ms WebSocket telemetry propagation, geofencing, and sub-1% battery drain.

TimelineMar 2024 — Sep 2024
Visibilitypublic
Artifacts
React NativeExpo SDKFastifyNode.jsPostgreSQLPostGISWebSocketTypeScript
Project screenshot
1. The Problem & Context

Why this project was initiated

CareRing is an open-source, production-engineered family safety ecosystem designed with zero telemetry monetization. Combines hardware-accelerated motion coprocessor filtering for sub-1% battery drain per hour, sub-50ms WebSocket telemetry propagation, and PostGIS spatial indexing for instant safe-zone arrival/departure triggers.

2. Technical Implementation & Highlights

Engineering Deliverables

Sub-50ms WebSocket telemetry propagation with 60 FPS mobile coordinate interpolation.
Hardware-accelerated motion coprocessor filtering with sub-1% battery drain per hour.
Dynamic geofencing with PostGIS spatial indexing for instant safe-zone arrival/departure triggers.
One-touch emergency SOS broadcast with zero-knowledge encrypted contact alerts.

Deep Dive: Real-Time Family Location Intelligence & Safety Platform

CareRing is a production-engineered, privacy-first family safety and emergency response ecosystem. Built as an open-source alternative to proprietary tracking apps that monetize location telemetry, CareRing guarantees a zero-telemetry-selling policy, sub-50ms WebSocket telemetry propagation, and hardware-accelerated motion coprocessor filtering for sub-1% battery drain per hour.

Architecture Overview

diagram
+-------------------------------------------------------------------------+
|                  Mobile Client (React Native / Expo 57)                 |
|      • Hardware Motion Coprocessor (Activity Recognition)               |
|      • 60 FPS Coordinate Interpolation on Vector Maps                   |
|      • Background Keep-Alive Event Dispatcher                           |
+------------------------------------+------------------------------------+
                                     |  (Sub-50ms WebSocket Stream)
                                     v
+-------------------------------------------------------------------------+
|                Fastify Node.js High-Throughput Gateway                  |
|      • Connection Room Management & JWT Session Verification            |
|      • Distributed WebSocket Fan-Out with Backpressure Control         |
|      • Real-Time Encrypted Chat & Alert Dispatcher                      |
+------------------------------------+------------------------------------+
                                     |
                                     v
+-------------------------------------------------------------------------+
|                Spatial Database Layer (PostgreSQL 16 + PostGIS)         |
|      • Spatial Indexing: ST_DWithin & GiST Indexes for Geofences        |
|      • Time-Series Telemetry & Breadcrumb Trails                        |
|      • Emergency SOS Contacts & Ring Circles                            |
+-------------------------------------------------------------------------+

1. Motion Coprocessor & Sub-1% Battery Optimization

Continuous GPS polling drains a typical smartphone battery in under 4 hours. To achieve continuous background safety without battery depletion, CareRing leverages the mobile device's hardware motion coprocessor (accelerometer + step detector):

  • •Stationary State: When the user is at home, school, or work, GPS sampling sleeps. The app relies on low-power cell tower and Wi-Fi geo-fences.
  • •Motion Transition: As soon as the coprocessor detects linear acceleration above pedestrian thresholds, GPS sampling dynamically ramps to adaptive intervals (every 10–15 seconds while driving, every 45 seconds while walking).
  • •Result: Average battery consumption is measured at < 0.8% per hour, allowing round-the-clock protection.

2. Spatial Geofencing with PostGIS

Safe zones (home, school, office) are evaluated in real time directly within PostgreSQL using PostGIS spatial functions:

Dynamic Geofence Proximity Check
SELECT 
    f.id AS fence_id,
    f.name AS fence_name,
    f.circle_id,
    ST_DWithin(
        f.geom::geography,
        ST_SetSRID(ST_MakePoint($1, $2), 4326)::geography,
        f.radius_meters
    ) AS is_inside
FROM geofences f
WHERE f.circle_id = $3;

When a member crosses a geofence boundary, the Fastify gateway evaluates state transitions and immediately dispatches push notifications and WebSocket alerts to all family circle members in under 50ms.

3. One-Touch Emergency SOS Protocol

In high-risk scenarios, pressing the emergency SOS button triggers a multi-channel cascade: 1. Pushes high-priority sound bypass notifications to all circle members. 2. Broadcasts real-time coordinate streaming at 1-second intervals. 3. Automatically attaches reverse-geocoded street addresses, battery level, and cellular signal strength.

Engineering Outcome & Takeaways

Shipping this project reinforced the value of clean architectural boundaries, automated verification loops, and clear error telemetry. In subsequent iterations, I focus on system observability, end-to-end integration test suites, and strict performance profiling under load.