Inspiration

When a disaster takes down cell service, a person can still be surrounded by charged phones and have no path to move a distress call. SafeRelay asks a simple question: can each nearby phone become one careful link in a local emergency relay, without pretending that transmission equals rescue?

Our team first explored disaster-relay ideas in 2025. For JacHacks SF, we rebuilt the product as a new Jac and Capacitor system during the event: a native field app, a compact Bluetooth protocol, and an evidence-scoped web console. The Jac implementation and its public commit history were created during the hacking window.

What it does

SafeRelay has two coordinated product surfaces:

  • The field relay lets a person create guarded emergency, medical, trapped, supplies, shelter, or safe reports with a location. It encodes each report into a fixed 25-byte packet, exchanges packets over Bluetooth Low Energy, rejects expired or duplicate traffic, stores evidence locally, and forwards eligible packets to nearby SafeRelay phones.
  • The cloud and operations path automatically attempts upload whenever any relay phone regains connectivity. A Jac endpoint validates and idempotently stores the signal, while an authenticated operations console combines received evidence with live USGS earthquake and NWS severe-weather records.

The mobile app also includes a Mapbox incident map, bounded offline OpenStreetMap tiles, RSSI proximity tools, responder handoff through QR, share, file, print, and SHA-256 digest, and an optional on-device Survival Guide powered by Apple Foundation Models. The guide is advisory, remains local to the phone, and is never inserted into relay packets or responder evidence.

The evidence model

Emergency software can become dangerous when it turns a successful button press into a claim that help is coming. SafeRelay keeps five states separate:

  1. packet created;
  2. packet received by a peer;
  3. packet stored by the Jac cloud relay;
  4. responder acknowledged;
  5. outcome known.

Each transition needs its own evidence. Unknown stays unknown. Public-feed failure keeps verified cache or reports unavailable; it never invents a fallback incident.

How we built it

Jac 0.34.7 owns the application logic, packet codec, relay policy, operational state, tests, server functions, and JSX-style client UI across two independent Jac projects.

On the web side, Jac nodes model disaster caches, source events, and mobile relay signals. Typed def:protect functions expose authenticated source refreshes against each operator's isolated root graph, while typed public functions provide bounded health and mobile-ingestion endpoints. JacHammer builds and hosts the web application from the same source.

On mobile, Jac compiles the field experience into a Capacitor 8 shell. Native Swift is limited to platform boundaries Jac cannot express directly: CoreBluetooth central and peripheral roles, background restoration hooks, local receipt notifications, the UIKit tab bar, and the Apple Foundation Models bridge. Mapbox GL renders only the device location and received mesh reports in the runtime map. Capacitor Preferences keeps packets, settings, attempt ledgers, and local evidence durable across relaunches.

The wire protocol is intentionally small: a big-endian header, sender, sequence, latitude, longitude, status, timestamp, and target in 25 bytes. Relay policy stops SAFE propagation, drops expired or over-hop traffic, preserves critical reports under queue pressure, and can defer lower-priority traffic in Battery Saver mode.

Challenges we ran into

The hardest engineering problem was not drawing a mesh diagram. It was managing both BLE roles on iOS while the app moves between foreground, Home Screen, and lock screen. We had to move receipt handling and notifications across the native boundary so delivery did not depend on a suspended WebView.

We also had to keep client and server variants of the Jac protocol consistent across separate compiler code spaces, make cloud sync retryable without double-counting receipts, and design every UI state around what the system can actually prove.

Accomplishments that we're proud of

We installed the same signed Debug artifact on an iPhone 15 Pro Max and an iPhone 17 Pro Max running iOS 27. Device evidence shows bidirectional native Bluetooth publication, foreground receipt and durable history, a persistent incoming-distress alert, background Home Screen receipt, and a lock-screen medical-emergency notification. The physical map rendered only the current device and stored mesh evidence, with no synthetic incident markers.

We are equally proud of what the product refuses to claim. A local receipt is not responder acknowledgement. A server receipt is not a rescue outcome. The browser preview never reports Bluetooth as active.

What we learned

Jac made the system feel like one product instead of a pile of adapters. The same language expresses protocol policy, graph persistence, server endpoints, tests, and the UI, while still allowing narrow native bridges for radio and OS lifecycle behavior. We also learned that resilience is as much about honest state and durable evidence as it is about transport.

What's next for SafeRelay

Next we will complete the fully network-isolated two-phone matrix in both directions, test system-terminated CoreBluetooth restoration, deploy and verify a permanent public JacHammer origin from physical phones, and validate the remaining torch, compass, speaker, microphone, and ultrasonic hardware paths. We also want to run structured drills with emergency-response partners so the handoff format and evidence language match real field practice.

Built With

Share this project:

Updates

Submission history