Cross-platform AI sports coach: nutrition from plate photos (Gemini), Intervals.icu (wellness, events), manual and FIT workouts, and an AI orchestrator that suggests Go/Modify/Skip for daily training. State and load (CTL/ATL/TSB) are based on Intervals/wellness and local workouts; Strava is no longer used.
- backend/ — FastAPI, PostgreSQL, Gemini (nutrition + orchestrator), Intervals.icu client, sync job, chat API
- frontend/ — Expo (React Native): dashboard, camera FAB, AI coach chat
- Copy env and set secrets:
cp .env.example .env # Edit .env: set POSTGRES_PASSWORD, GOOGLE_GEMINI_API_KEY (and optionally ENCRYPTION_KEY, SECRET_KEY) - Build and start:
make build make up make migrate
- Open http://localhost (frontend). API is at http://localhost/api/v1/ (proxied via nginx).
- Optional: create a user in the DB (see backend/README.md) so the app has a user for nutrition and chat.
- Production: When deploying behind HTTPS, set
ENABLE_HSTS=truein.envso the API adds theStrict-Transport-Securityheader (see docs/DEPLOY.md).
Make targets: make build, make up, make down, make logs, make migrate, make shell-backend, make ps, make logs-backend, make logs-frontend, make logs-db.
Copy deploy.env.example to deploy.env, set DEPLOY_HOST and DEPLOY_TARGET=prod, then run make deploy. See docs/DEPLOY.md: Phase 0 (server analysis and cleanup), then git clone, .env from .env.production.example, Caddy HTTPS.
cd backend
cp .env.example .env # set DATABASE_URL, GOOGLE_GEMINI_API_KEY
pip install -r requirements.txt # or uv sync
alembic upgrade head
# Create a user (see backend/README.md)
uvicorn app.main:app --reloadcd frontend
npm install
# Set EXPO_PUBLIC_API_URL in .env (e.g. http://localhost:8000)
npx expo startPOST /api/v1/nutrition/analyze— upload meal photo → Gemini → JSON (name, calories, macros), saved tofood_logPOST /api/v1/intervals/link— store Intervals.icu athlete_id + API key (encrypted)GET /api/v1/intervals/events,GET /api/v1/intervals/activities— planned events and activities from IntervalsGET /api/v1/wellness,PUT /api/v1/wellness— wellness (sleep, RHR, HRV) and optional CTL/ATL/TSBGET /api/v1/workouts,POST /api/v1/workouts,PATCH /api/v1/workouts/{id},DELETE /api/v1/workouts/{id}— manual and FIT workoutsGET /api/v1/workouts/fitness— CTL/ATL/TSB computed from workoutsPOST /api/v1/workouts/upload-fit— upload a .fit file (dedupe by checksum)GET /api/v1/chat/history,POST /api/v1/chat/send— chat with AI coachPOST /api/v1/chat/orchestrator/run— run daily decision (Go/Modify/Skip) from wellness + workouts + Intervals events
- robots.txt and favicon: in
frontend/public/(robots.txt, favicon.svg). For Expo web build, copy these to the served root if your setup does not use a public folder. - Gzip: Caddy and nginx enable gzip by default for static assets. For a custom server, enable gzip for
application/javascriptand text MIME types to reduce JS bundle transfer size.
- Sprint 1: Backend + Gemini nutrition
- Sprint 2: Intervals.icu client, sync, wellness cache
- Sprint 3: AI Orchestrator (3-level hierarchy, structured output)
- Sprint 4: Frontend (dashboard, camera, chat)