2.2 KiB
2.2 KiB
Fitness Web Agent Notes
Project Overview
Multi-user fitness tracking web app with AI coaching. Replaces the fitness-agent markdown-based training repo.
Related Repo
~/git/fitness-agent— Training markdown logs, agent config, historical data, Juggernaut cycles- This repo (
fitness-web) is the web app successor. When this is fully operational, the old repo can be archived.
Architecture
- FastAPI — async Python web framework
- Jinja2 + Pico.css — server-rendered templates with minimal CSS framework (CDN)
- SQLite + SQLAlchemy 2.0 async — database with aiosqlite driver
- opencode serve — AI coach service (Big Pickle model, free). Runs as a separate process/container.
Key Files
app/main.py— App factory, route registration, lifespanapp/config.py— Environment-based configurationapp/auth.py— Password hashing, session management,get_current_userdependencyapp/models/— SQLAlchemy ORM modelsapp/routers/— Route handlers (one per feature)scripts/schema.py— DB initializationscripts/seed.py— Seed data (exercises, phases)opencode/fitness-trainer.md— Agent config for AI coach (copied from fitness-agent)
Commands
uv sync # Install deps
uv run python scripts/schema.py # Create DB tables
uv run python scripts/seed.py # Seed initial data
uv run uvicorn app.main:app --reload # Dev server on :8000
Key Decisions
- Session-based auth with DB-backed tokens (simple, no OAuth dependencies)
- SQLAlchemy async with aiosqlite (works well with FastAPI async handlers)
- SSE streaming for chat responses
- Pico.css from CDN (no build step)
- Chat messages stored in DB per session for history
- Docker Compose for deployment (opencode serve service commented out until ready)
Next Steps / TODOs
- Seed exercises and phases (done via
python scripts/seed.py) - Add exercise progress chart (matplotlib or chart.js)
- Enable opencode serve integration (uncomment docker-compose service)
- Migrate existing markdown logs from fitness-agent repo into DB
- Migrate Juggernaut training xlsx data into DB
- Add calendar view for training history
- PWA manifest + service worker for offline-capable mobile use