SmartTrip MVP is a trip planner where a user creates a trip, adds ordered stops, gets walking route metadata (distance + time), and exports that ordered route to Google Maps.
Users need a simple way to:
- Create a trip.
- Add and reorder stops.
- Compute walking distance/time for that exact stop order.
- Export to Google Maps.
Out of scope for MVP:
- Booking/calendar sync
- Budgets/payments
- Reviews
- AI itinerary generation
- Frontend: Next.js App Router (React + TypeScript)
- Backend: Hapi server (
server/) with controller/data-source layers - Database: Supabase Postgres
- Directions provider: Mapbox Directions API
- Export provider: Google Maps URL format
This repo now uses a dedicated layered architecture:
server/api-routes/: endpoint registry and route definitionscontrollers/: request orchestration and handler methodsdata-sources/: downstream API + DB accessplugins/: request context and GraphQL pluginsgraphql/: schema and executionstores/: runtime MobX state (server-side scaffolding)
client/views/: UI scaffolding by routecontrollers/: map pages to viewscomponents/: shared presentational componentsstores/: MobX client stores
shared/config/,constants/,types/,utils/: shared code between server/client
config/global.config.jsonc- Global toggles, Hapi settings, endpoint security levels, downstream URLs, webpack settings
Notes:
- Next.js API handlers were removed; API calls are handled by Hapi.
- Next.js proxies
/api/*and/graphqlto Hapi using rewrites. - Active trip context is read from cookie (
smarttrip_active_trip_id) orx-active-trip-id.
- Use Node from
.nvmrc:nvm installnvm use
- Install dependencies:
npm install
- Copy env:
cp .env.example .env.local
- Fill keys in
.env.local. - Run app (client + server together):
npm run dev
- Open API docs:
http://localhost:3000/swagger
- Check integration health:
http://localhost:3000/api/health/connections- or see the connection panel on the home page (
/)
NEXT_PUBLIC_SUPABASE_URLNEXT_PUBLIC_SUPABASE_ANON_KEYSUPABASE_SERVICE_ROLE_KEYSUPABASE_DB_URLMAPBOX_ACCESS_TOKEN
Migration file:
supabase/migrations/20260303124500_init_smarttrip.sql
Core tables:
tripsstopsroutes
Why schema is under supabase/migrations/:
- Supabase applies SQL files in this folder in order.
- Each file is a versioned history of schema changes.
- This lets teams reproduce DB state safely across local/staging/prod.
Learning docs:
docs/data-model.md(entities + examples)docs/api-design.md(endpoint contracts + curl examples)docs/postgres-crash-course.md(junior-friendly SQL concepts for this MVP)docs/nextjs-crash-course.md(Next.js concepts needed for this MVP)docs/architecture-separation.md(client/server/shared boundaries and use cases)
Implemented endpoints:
GET /api/openapiGET /api/health/connectionsGET /api/tripsPOST /api/tripsPOST /api/trips/select-active(sets active trip cookie)GET /api/trips/currentPATCH /api/trips/currentDELETE /api/trips/currentGET /api/stops/current-tripPOST /api/stops/current-tripPATCH /api/stops/current-trip(payload includesstopId)DELETE /api/stops/current-trip(payload includesstopId)POST /api/stops/current-trip/reorderGET /api/route/current-trip?mode=walkPOST /graphqlPOST /api/dispatch/{endpointName}(generic endpoint-name dispatcher)
Temporary auth for MVP API testing:
- send header
x-user-id: <uuid>