Dark-themed hiking safety companion with:
- Supabase auth (email/password)
- Breadcrumb tracking via
expo-location+react-native-maps - Safety check-ins with expected return time
- Hazard reporting + 48h hazard counts (Supabase)
- AI-powered safety score (Gemini via OpenRouter)
- Node 18+ (nvm recommended)
- Expo CLI (bundled via
npm run start) - iOS simulator / Android emulator / physical device
- Supabase project (auth enabled)
npm installCreate .env in repo root:
GOOGLE_MAPS_API_KEY=...
API_BASE_URL=http://localhost:3000/api
SUPABASE_URL=...
SUPABASE_ANON_KEY=...
MAPBOX_ACCESS_TOKEN=... # optional, if using Mapbox Directions
OPENROUTER_API_KEY=... # required for AI safety score
Types for env vars live in src/types/env.d.ts.
- Run migrations in SQL editor (or
supabase db pushif using CLI):supabase/migrations/202501180001_hikes.sql(hikes, breadcrumbs, RLS)supabase/migrations/202501200001_hazards.sql(hazards, RLS, purge cron)
- Ensure
pg_cron/pg_netare enabled for the purge job. - Set Edge Function secrets (Postmark alerts, service role, etc.) if you use the overdue alert flow:
SUPABASE_SERVICE_ROLE_KEYPOSTMARK_SERVER_TOKENPOSTMARK_FROM_EMAILALERT_GRACE_MINUTES
- Deploy edge function (overdue alerts) if needed:
Schedule via cron in Supabase UI or SQL.
supabase functions deploy send-overdue-alerts
npm run start -- --clearScan the QR or open in simulator/emulator.
- Auth: Supabase email/password (
LoginScreen/SignUpScreen). - Check-in: set contact + return time on Trail screen (single prompt).
- Breadcrumbs:
useLocationusesexpo-location; points saved to AsyncStorage. - Hazards: report from Hike screen; counts shown on Trail screen (last 48h, purged via cron).
- Safety score: Trail screen calls OpenRouter (Gemini 2.5 Pro) with weather, sunset, hazards; falls back to local score if API fails/missing key.
- Maps:
react-native-maps, Google Routes for walking polyline; Mapbox helper exists but optional.
- Use Demo Mode (UI toggle) to add simulated points.
- Report a hazard to see hazard count and AI score update on Trail screen.
- Watch Metro logs for OpenRouter requests/responses.
- No backend changes are made on UI tweaks; auth and storage remain as-is.
- If Routes/Maps fail, the app gracefully degrades (no crash).