Repository navigation
Architecture Overview
hasnaina955 edited this page Sep 3, 2026
·
1 revision
Condensed map of the system. Full tour: docs/ARCHITECTURE.md.
Pages (React) ──▶ lib/ (pure functions) ◀── store.ts (reactive cache)
│ │
components (map, modals) Supabase JS client
│
Supabase (Postgres + Auth): 8 tables,
Row Level Security everywhere
External (keyless, failure-safe): Open-Meteo geocode · OSRM routing ·
Wikipedia geosearch · OSM Overpass · Mappls · OpenFreeMap tiles
| Layer | Location | Rule |
|---|---|---|
| Pages | src/pages/ |
React components; TripWorkspace.tsx hosts the 8 workspace tabs |
| Pure logic | src/lib/ |
No React, no I/O (except supabase.ts); engine, impact, ridePlan, geocode facade, providers |
| Store | src/store/store.ts |
useSyncExternalStore over an in-memory cache; hydrates from Supabase, writes through with error checks + rollback |
| Maps |
src/components/TripMap.tsx + mapcn/
|
MapLibre; never import maplibre-gl types directly — structural casts |
| Data model | src/data/types.ts |
Times are 24h "HH:MM" strings; coordinates are plain numbers |
-
Hydration: login →
init()loads all 8 tables into the cache (per-table error logging) → UI renders from cache -
Mutation: update cache → persist via
persistTripField(.from('trips').update) → error ⇒ toast + rollback -
Realtime: one
postgres_changeschannel over all tables; own writes echo-suppressed; reducers are pure (realtimeCore.ts) -
Impact preview: every edit simulates the day (
simulateDay) and shows time/cost deltas before saving
259 vitest tests, node env (no DOM) — pure logic only; provider calls mocked with route tables; vi.stubEnv for API keys. Run everything with npm run verify (see Release Process).
Related: Design Decisions · Data Sources and Limits
YatraFlow · Repo · Docs index · Changelog
Repo docs are canonical — wiki pages are summaries that link to them.
YatraFlow Wiki
Learn
Do
Understand
Look up
Repo