This is a submission for the DEV Weekend Challenge: Community
The Community
Every other Saturday morning, somewhere in the hills outside Abuja, a group of 300 to 400 people lace up their boots, adjust their packs, and head out onto a trail together. They are accountable to each other in the way that only people who regularly disappear into the wilderness together can be — a WhatsApp thread that goes silent when signal dies, a laminated emergency contact list that lives in a leader's back pocket, a shouted headcount at the trailhead that somehow always comes up one short.
This community is real. Large organised hiking clubs exist in almost every country — running weekly or fortnightly hikes that bring together hundreds of people of different fitness levels, ages, and experience. The organiser knows every face. The leaders know which hikers have heart conditions, who tends to lag at the back, who has never hiked before and signed up on a whim.
And yet when something goes wrong — a twisted ankle two kilometres from the trailhead, a hiker who didn't come back around the ridge, a diabetic whose lunch slipped out of their bag — the response is still fundamentally analogue. Someone shouts. Someone runs. Someone tries to call a number saved under "Dr. Mike (hike leader)" and gets no signal.
Trail Safe was built for this community. The organizers who carry the weight of 400 people's safety in their heads. The volunteer leaders who sprint down a hill toward someone they've never met. The hikers who signed up for fresh air and ended up needing help they couldn't ask for fast enough.
What I Built
Trail Safe is a Progressive Web App that gives large hiking groups a real-time safety layer — from the moment the organizer creates a hike, to the moment the last hiker walks back to their car.
It replaces paper sign-in sheets, WhatsApp broadcasts, and shouted headcounts with three role-specific tools that work together:
For the Organiser
Create a hike in under a minute. Share two invite links — one for leaders, one for hikers. Watch a live manifest as hikers check in. See the exact GPS coordinates of any SOS as it fires. End the hike and every connected device disconnects simultaneously.
For Leaders
Join via link, no account needed. Receive an audible alert the moment a hiker fires SOS. Get auto-assigned based on proximity — the system calculates the haversine distance from every active leader to the hiker's GPS coordinates and dispatches the nearest one. Open the compass screen and navigate directly to the hiker in real time, with bearing and live distance countdown.
For Hikers
Register your emergency info once — blood type, medical conditions, medications, allergies, emergency contact. It's saved offline to your device. Check in at the trailhead. If something goes wrong, one tap opens the SOS screen. Select the emergency type, add a note, and send. Help is on the way. The screen shows you who is responding and how far away they are.
The entire system is designed to work on trails with no cell signal. GPS runs on the device chip, not the network. Firestore offline persistence queues writes and syncs when signal returns. The SOS alert sound is synthesised in the Web Audio API — no files, no server, no internet required. The emergency card is cached to localStorage and accessible as a PWA offline.
Demo
Live app: trail-safe-fafdd.web.app
To test the full flow, open three incognito windows:
| Window | Steps |
|---|---|
| Organiser | Open app → Organizer Access → PIN 1234 → Create Hike → Start Hike → Copy invite links |
| Leader | Open the leader invite link → Fill name + role → Join |
| Hiker | Open the hiker invite link → Register → Check In → Fire SOS |
The leader window will receive an audible three-beep alert and see the incident. Tap Respond → the compass opens with live bearing and distance to the hiker's GPS location. Tap Arrived — Close Incident and the hiker's screen updates to "Help has arrived."
Code
odeh-simon
/
trail-safe
Hike safety & emergency dispatch app for hiking community
Trail Safe
Real-time safety management for hiking groups.
Trail Safe is a Progressive Web App built for hiking communities of 300–400+ members. It replaces paper sign-in sheets and radio check-ins with GPS-based check-in, one-tap SOS emergency alerts, and compass-guided leader dispatch — all designed to work on trails with no cell signal.
The Problem
Large hiking groups face a real coordination gap when something goes wrong on the trail. Leaders don't know where hikers are. Organizers can't confirm who made it back. When a hiker is injured or lost, critical minutes are lost figuring out who is closest and how to reach them.
Trail Safe solves this with three role-specific tools that work together in real time.
How It Works
Three Roles
Organizer creates the hike, shares invite links, monitors the full group dashboard, and ends the hike when everyone is back safe.
Leaders join via invite link, receive GPS-targeted…
How I Built It
Stack
| Layer | Choice | Why |
|---|---|---|
| Frontend | React 18 + Vite | Fast HMR, clean component model |
| Styling | Tailwind CSS + shadcn/ui | Consistent design tokens, accessible primitives |
| Database | Firebase Firestore | Real-time onSnapshot, offline persistence, no backend to run |
| Auth | Firebase Anonymous Auth | Zero friction — no accounts, no passwords |
| State | Zustand | Simple, minimal, no boilerplate |
| Location | Browser Geolocation API (watchPosition) |
Works offline, device GPS chip |
| Compass | DeviceOrientationEvent |
Native bearing on iOS and Android |
| Sound | Web Audio API | Synthesised beeps, no files, works offline |
| Distance | Haversine formula (pure JS) | No library needed for this |
| PWA | vite-plugin-pwa + Workbox | Install to home screen, cache assets |
| Deploy | Firebase Hosting | Zero config, global CDN |
The decisions that mattered most
Roles via Firestore, not session state. Each user's role is stored in /users/{uid}.role and watched with onSnapshot. When the organiser ends a hike, every connected device gets a role update within a second and RoleGuard redirects them home. No polling. No client-side coordination. The database is the source of truth and the broadcast mechanism at the same time.
Invite links instead of role selection. There is no "I'm a leader" button on the landing screen. Leaders and hikers join via unique per-hike URLs. This eliminates the problem of two people on the same device overwriting each other's roles, and it gives the organiser control over who can join before the hike starts.
Auto-dispatch at SOS fire time. When a hiker fires SOS, the system immediately queries all active leaders, calculates the haversine distance from each to the hiker's GPS coordinates, and assigns the nearest one. The leader doesn't need to accept the assignment — they just receive the alert and navigate. In an emergency, removing friction from the response chain matters.
Offline-first, not offline-aware. There is a difference between an app that degrades gracefully and one that is designed for no signal. Trail Safe uses persistentLocalCache with persistentMultipleTabManager (the Firebase v12 API — the old enableIndexedDbPersistence is deprecated). GPS runs on the device chip. The compass bearing is calculated locally from DeviceOrientationEvent. The emergency card is in localStorage. SOS writes queue in Firestore's local cache and sync when signal returns. A hiker on a ridge with zero bars can still fire SOS and it will reach the leader the moment either of them moves back into coverage.
Background GPS for leaders. Leaders need to have their location recorded even when they're not looking at the compass screen. A setInterval on the dashboard writes GPS to Firestore every 10 seconds, using a ref to hold the latest coordinates (avoiding stale closure issues with intervals). This means auto-dispatch works from the moment a leader loads the dashboard — they don't have to open the compass first.
The build
I built this over a weekend, working through a structured phase plan: auth and role system first, then the core SOS flow, then responsive layouts and desktop polish, then GPS edge cases and offline hardening. The toughest part was the iOS compass — DeviceOrientationEvent.requestPermission() must be called from a direct user gesture, which means you can't request it on mount. The compass screen has a one-step permission gate that resolves this.
The most satisfying part was the moment everything connected: three browser windows open, hiker fires SOS, the leader window beeps, the incident appears, the compass opens and the needle points at the hiker's location while the distance counts down in real time. That's the thing this community actually needs — and it works.
Built solo for the DEV Weekend Challenge.
Top comments (0)