Architecture overview: how the stack fits together, what runs when, and how data flows.
| Layer | Technology | Notes |
|---|---|---|
| Native app | React Native + Expo, TypeScript | expo-router for navigation |
| Backend | Next.js App Router | Deployed on Vercel |
| Database | Supabase (PostgreSQL) | Service role key, no RLS |
| AI | Gemini 2.5 Flash | temp 1.0, thinkingBudget 1024 |
| Maps | Google Maps SDK (native) | Google Places API for POIs |
| Auth | None | user_id = device UUID in AsyncStorage |
| Push | Expo Push Notifications | Backend built; frontend pending Apple Developer Program |
All cron jobs are Vercel Cron hitting bare GET endpoints, protected by CRON_SECRET. Times are UTC.
| Schedule (UTC) | Endpoint | What it does |
|---|---|---|
05:00 daily | /api/cleanup | Expire old walks, prune orphaned data |
00:15 daily | /api/taste/batch-update | Recompute taste profiles from recent walk behaviour |
14:00 daily | /api/notifications/streak-nudge | Streak reminder for active walkers (4pm Madrid summer) |
08:00 daily | /api/notifications/comeback-nudge | Re-engagement nudge for inactive users (10am Madrid summer) |
09:00 daily | /api/notifications/quest-reminder | Remind users of accepted but incomplete quests (11am Madrid summer) |
10:30 daily | /api/notifications/weather-window | Good weather walking nudge (12:30pm Madrid summer) |
11:00 daily | /api/notifications/live-event | Notify users of new live events (1pm Madrid summer) |
/api/quests/dailyquest_library filtered by day_types, neighbourhood proximity, and tags/api/quests/tailored runs Gemini to pick a personalised quest/api/quests/local generates quests via Gemini with live Google SearchuseSnap hookutils/compress.ts)/api/photos/upload/api/quest/validate-snap runs Gemini vision to classify themesclassified_themes written to photo_snaps rowdetection_themes, progress increments/api/taste/seed creates initial profile/api/taste/batch-update analyses recent walks, snaps, and quest completions/api/quests/tailored quest selectionreroute-app/ # React Native + Expo (TypeScript)
app/ # expo-router screens
(tabs)/ # Tab screens: index, walk, diary
_layout.tsx # Root layout
components/ # UI components
hooks/ # 17 custom hooks
api/ # Client-side API wrappers
context/ # WalkContext.tsx
config/ # theme.ts, api.ts, mapStyle.json
utils/ # compress.ts, geo.ts, time.ts
Build/ # Next.js on Vercel (backend)
src/app/api/ # 52 API route handlers
src/data/migrations/ # 13 Supabase SQL migrations