Ocean Sentinels: An Offline App for Coastal Communities
The full build: a web dashboard, an Android app with 21 screens, a FastAPI backend, and a Bluetooth mesh that relays reports when there is no internet.
When a natural disaster takes out the cell towers, coastal communities are cut off at the moment they most need to be heard. Ocean Sentinels turns ordinary Android phones into a Bluetooth mesh network: a hazard report hops from phone to phone until any one of them finds a connection, and then it reaches rescue teams and authorities.
This one is personal. India's coastal communities are among the most disaster-prone in the world, and the cruel part is that when a disaster hits hardest, communication goes first. Nobody should be unreachable because a tower fell.
The platform
Ocean Sentinels is three pieces that work together.
- Web app: a Mapbox map with live incident markers, separate dashboards for four kinds of user (public, authority, rescue team and admin), live notifications over WebSockets, and analytics charts.
- Android app: 21 Jetpack Compose screens in Material 3, built offline-first with Room, plus Firebase push notifications, GPS tracking and the Bluetooth mesh.
- Backend: FastAPI and PostgreSQL with async database access, more than 16 REST endpoints, JWT sign-in, role-based access and de-duplication of mesh messages.
How the mesh works
This is the heart of the project. When there is no internet:
- Someone files a hazard report on their phone.
- The report is broadcast over Bluetooth Low Energy to phones nearby, about 400 m away.
- Each phone stores it, carries it and passes it on.
- As soon as any phone in the chain gets online, the report uploads and the authorities are alerted.
No special hardware. Just phones.
The details that make it hold up:
- Coded PHY S8. Eight-times forward error correction stretches Bluetooth's range to about 400 m, against roughly 100 m normally.
- A 72-hour expiry instead of a hop limit. In a disaster a chain can run past 50 phones before it reaches the internet, so messages expire by time, not by hops.
- De-duplication in three layers: the relay path each message carries, an in-memory cache of the last 10,000 message IDs, and a check in the database.
- Deterministic message IDs. A SHA-256 hash means the same report from the same phone always gets the same ID, wherever it surfaces.
- A fallback for older phones. The app tries Coded PHY first for range and drops to the standard 1M PHY on devices that don't support it.
Every phone can play every role
What happens to a report
| Setting | Value |
|---|---|
| Phones connected at once | 7 |
| Fragment size | 469 bytes |
| Largest packet | 512 bytes |
| De-duplication cache | 10,000 message IDs |
| Message lifetime | 72 hours |
| A peer counts as gone after | 180 seconds |
| Scanning restarts every | 30 seconds |
| Radio | Coded PHY for range, 1M PHY as fallback |
The protocol, layer by layer
Messages on the mesh are encrypted with ChaCha20-Poly1305.
Built with
| Layer | Stack |
|---|---|
| Backend | Python 3.11, FastAPI, SQLAlchemy 2.0 (async), PostgreSQL, JWT, WebSockets |
| Web | JavaScript, Mapbox GL JS, CSS |
| Android | Kotlin, Jetpack Compose, Material 3, Hilt, Room, Retrofit, Mapbox SDK, Firebase |
| Mesh | BLE 5.0 Coded PHY S8, GATT server and client, SHA-256 de-duplication, foreground service |
Tested in the open
Screens
Try it
- Open the web app
- Download the Android app (APK)
- The iOS version is built but not released yet. Its source is in the repository.
Built for coastal communities everywhere. When the network goes down, the mesh goes up.
The full story is in the Ocean Sentinels case study.
An earlier version of this post appeared on DEV