This file provides context and instructions for AI coding agents (GitHub Copilot, Cursor, Cline, Aider, etc.) working on this codebase.
AI Cycling Coach — a web app where cyclists chat with an AI coaching agent to build training plans. The AI creates workouts on a calendar; users log ride results.
| What | Where |
|---|---|
| Backend entry point | backend/run.py |
| Flask app factory | backend/app/__init__.py |
| Database models | backend/app/models/ |
| API routes | backend/app/routes/ |
| AI coach logic | backend/app/services/coach_agent.py |
| Frontend entry | frontend/src/main.tsx |
| React router | frontend/src/App.tsx |
| API client | frontend/src/services/api.ts |
| TypeScript types | frontend/src/types/index.ts |
| Living plan | Plan.md (update this as you make changes) |
# Backend
cd backend
python -m venv venv && source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env # then edit with your API key
python run.py # http://localhost:5000
# Frontend
cd frontend
npm install
npm run dev # http://localhost:3000 (proxies /api to :5000)
app/models/, with a to_dict() methodapp/routes/app/services/, not in route handlersfirst_or_404() for lookups; return JSON error responsessrc/types/index.tssrc/services/api.ts (single source of truth)index.cssuseState; no Redux needed at current scalebackend/app/models/backend/app/routes/backend/app/__init__.py (if new file)frontend/src/services/api.tsfrontend/src/types/index.tsSYSTEM_PROMPT in backend/app/services/coach_agent.py_build_context() method controls what data the AI sees_extract_and_save_workouts() method parses AI output for workout JSONfrontend/src/components/frontend/src/App.tsxfrontend/src/components/Layout/AppLayout.tsxPlan.md first to understand current project statePlan.md after completing significant workCoachAgent class is the core intelligence — it builds context from DB, manages conversation history, and extracts structured workout data from AI responses