DEV Community

Cover image for TrailWatch: Durable Wilderness Safety Dispatch for Solo Hikers
Anant Kumar
Anant Kumar

Posted on Originally published at dev.to AI-assisted

TrailWatch: Durable Wilderness Safety Dispatch for Solo Hikers

Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass Submission 🌿

This is a submission for the Hacktoberfest Open-Source AI Challenge Week 1: Touch Grass


What I Built

Most outdoor apps do the opposite of getting you off your screen. They buzz with leaderboards, demand live tracking on battery-draining visual maps, and keep your eyes glued to glass instead of the trail.

I built TrailWatchβ€”a fault-tolerant, screen-free wilderness safety agent designed to do its job and get out of your way.

TrailWatch acts as an autonomous digital companion for solo hikers, trail runners, and backpackers heading into areas with spotty cellular coverage.

Here is how it works:

  1. Pocket & Disconnect: At the trailhead, you spend 15 seconds entering your intended route, safety window (e.g., 3 hours), and an emergency contact.
  2. Durable Watch in the Cloud: Once you start your trek, you close the tab, lock your phone, and head into the woods. If you lose cell service 10 minutes later, it doesn't matterβ€”an uncrashable state machine is actively monitoring your timeline on the server.
  3. Opportunistic Location Syncing: While you hike, your phone tracks satellite GPS locally, buffering breadcrumbs offline. If you catch even two seconds of faint cell reception on an open ridge, it quietly uploads your freshest coordinates without demanding interaction.
  4. Autonomous Emergency Protocol:
    • Safe Outcome: If you make it back and tap "I'm Safe", the watch concludes.
    • Overdue Outcome: If an accident occurs and your safety window lapses with zero check-in, TrailWatch autonomously pulls real-time meteorological data along your trail corridor, formats a structured Search & Rescue dossier with your last known GPS coordinates and Google Maps pin, and alerts your emergency contact.
    • Stand-Down Protocol: If you were simply delayed and check in after an alert went out, TrailWatch automatically dispatches a follow-up "Stand-Down / All-Clear" resolution email to cancel false alarms.

Demo

  • Demo Video:

How It Handles Edge Cases:

  • Offline Simulation: Switching the client to Airplane mode queues GPS points locally in localStorage. Once a data connection flickers back, it flushes the latest fix upstream.
  • Worker Crash Proof: Even if the cloud hosting instance restarts or is redeployed mid-hike, the timer preserves state across reboots without losing track of the hiker's safety window.

Code

The entire codebase is open-source and structured with a TypeScript Temporal core, an Express gateway, and an offline-first PWA client.


How I Built It

TrailWatch is built around a decoupled architecture where durability and offline fault tolerance are first-class citizens:

[Hiker Phone (Offline PWA)]
   β”œβ”€β”€ Satellite GPS (navigator.geolocation)
   └── Offline Buffer (IndexedDB / LocalStorage)
               β”‚ (Opportunistic Sync when signal blips)
               β–Ό
[Express Gateway + Temporal Client]
               β”‚
               β–Ό
[Temporal Durable Workflow Engine]
   β”œβ”€β”€ Non-blocking Timer: await condition(() => isSafe, timeoutMs)
   β”œβ”€β”€ Dynamic Signals: updateLocationSignal, checkInSafeSignal
   └── Activities (Real-World I/O):
         β”œβ”€β”€ Open-Meteo API (Live temperature, precipitation & wind telemetry)
         └── Resend Delivery Engine (Emergency rescue dossiers & stand-down alerts)
Enter fullscreen mode Exit fullscreen mode

1. Durable Execution with Temporal

The hardest engineering problem in safety check-in systems is reliability. A standard Node.js server cannot just run a 5-hour setTimeout(). If the server container crashes, sleeps, or re-deploys, that timer in memory vanishes, leaving a hiker stranded in the woods with no alert ever being sent.

Temporal provides durable execution. In src/workflows.ts, I modeled the hiker safety watch using deterministic primitives:

// The workflow durably pauses across process restarts and server upgrades
const safeBeforeDeadline = await condition(() => isHikerSafe, timeoutMs);

if (!safeBeforeDeadline) {
  // Query real-time weather and dispatch rescue packet
  const weather = await fetchTrailWeather(state.trailName, state.lastCoordinates);
  const packet = await buildRescuePacket(state, weather);
  await notifyEmergencyContact(state.emergencyContactEmail, packet);

  // Post-alert grace period for late resolutions
  const safeAfterAlert = await condition(() => isHikerSafe, postAlertGraceMs);
  if (safeAfterAlert) {
    await sendStandDownNotification(state);
  }
}
Enter fullscreen mode Exit fullscreen mode

Signals (updateLocationSignal, checkInSafeSignal) allow the mobile device to mutate the state of the long-running workflow asynchronously whenever network connectivity appears.

2. Live Environmental Telemetry

When an alert triggers, first responders need environmental context. TrailWatch queries Open-Meteo's open meteorological models using the hiker's exact last transmitted coordinate fix to supply current temperature, apparent temperature ("feels like"), wind gusts, and precipitation to calculate exposure risk.


Why Does Open Innovation Matter?

When building tools designed for human safety in extreme or disconnected environments, closed platforms introduce dangerous failure modes:

  1. Vendor Lock-in & Black-Box Outages: If a proprietary SaaS automation tool quietly drops a webhook or limits background task execution, people could get hurt. Temporal's open-source durable execution engine gave me complete visibility into the state machine and guaranteed that no check-in timer could silently disappear.
  2. Transparent Privacy for Hikers: Outdoor enthusiasts care deeply about location privacy. By relying on open code and clear coordinate caching protocols, hikers can see exactly when and where their coordinates are transmitted without constant tracking telemetry running in the background.
  3. Open Meteorological Telemetry: Using open weather data and open web standards allows any developer to build tools that serve outdoor communities without paying commercial API tolls per ping.

Prize Categories

  • Best Use of Temporal: TrailWatch leverages Temporal workflows, durable timers, asynchronous signals, and resilient activities to ensure long-running hiker monitoring survives server reboots, network dropouts, and container lifecycles.

Built with TypeScript, Temporal, Express, Open-Meteo, and Resend. Turn off your notifications, leave the feed behind, and go touch grass.

Top comments (0)

Some comments may only be visible to logged-in visitors. Sign in to view all comments.