roadpulse·design doc

RoadPulseprototype

Ambulance alerts for the drivers actually in its way — not everyone nearby.

spec.yaml
type:
Independent product · in development
context:
Built independently
area:
Mobile · Geospatial · Real-time
stack:
8 technologies
React NativeExpoNestJSPostgreSQLPostGISPrismaRedux ToolkitMapLibre

01Problem

Ambulances lose minutes in traffic because drivers find out too late. Radius-based "nearby" alerts notify everyone around, so people learn to ignore them.

02Approach

A relevance engine on the road network: a driver is alerted only when they are ahead of the ambulance on the same carriageway, waiting at a junction it will cross, or oncoming on an undivided road. Alerts escalate with distance and clear once the ambulance has passed.

03Architecture← the interesting bit

  1. Expo / React Native app with two modes: anonymous driver mode and authenticated emergency-operator mode
  2. NestJS modular monolith; PostgreSQL + PostGIS for the road graph, map matching and spatial queries
  3. A* routing over the stored road network, so routes and relevance use the same roads
  4. Alert lifecycle: NORMAL → HEAVY → IMMEDIATE by road distance, resolved automatically once passed
  5. MapLibre GL + OpenFreeMap in a WebView — no map API key, same map on phone and web

04From the notebook

who gets the alert? — RoadPulseroads, not radii!operator phoneemergency mode onGPSNestJS APImap-match positionA* on the road graphPostGIS• road graph• one-way, divided?relevance engineahead, same carriageway?at a junction it will cross?oncoming, undivided road?all three are 'yes' casesdriver's phoneNORMAL → HEAVY → IMMEDIATEby road distance"speed up!"→ give way when safealert all within 500 m✗ people learn to ignore itpasses → alert clears

05Trade-offs & hard parts

risk.01Deciding relevance on roads, not radii: divided carriageways, junctions and direction of travel all change who should be warned.
risk.02Never encouraging unsafe driving: every alert says "give way when safe", never "speed up" or "jump the signal".

06Ownership

owner: Everything — product, the relevance engine, the backend and the mobile app.

— Hankish

07Outcome

Working prototype, tested end to end on a simulated road network. Next: real road data from OpenStreetMap, traffic-police alerts at signals, and alerts in Hindi.

08Screens

Driver screen: emergency vehicle approaching, prepare to give way, 430 metres
Driver screen with the ambulance visible on the map, 230 metres away
Operator screen: emergency mode active, route to City Hospital, ETA and drivers alerted
next: /services/ramionRamion