Architecture

Repository layout

apps/
  mobile/        Expo app for iOS, Android, and web
  api/           Fastify backend
  whoop/         Gallant compatibility dashboard, worker, and shared analytics
packages/
  contract/      ts-rest route definitions and shared request/response types
  db/            Drizzle schema, migrations, and database helpers

Why this shape

The main API owns 3plates authentication and manual logs. It resolves the linked WHOOP subject server-side and accesses the existing Gallant database through an in-process adapter. The standalone Gallant worker retains its singleton lock, request budgets, and history, and the existing web service continues to receive webhooks and serve public shares. See the integration operations guide.