2.3 KiB
2.3 KiB
Agent Notes
Repo Shape
- Monorepo split:
frontend/is the React/Vite app;services/bff/owns auth, users, media upload, and frontend-facing API;services/logic/owns catalog, workouts, analytics, builtin seed data, and internal APIs. - Python services are a uv workspace rooted at
services/; use the sharedservices/.venv, not per-service virtualenvs. - Keep dev tools (
ruff,ty,pytest) in theservicesworkspace dev group only. Docker runtime images must not runuv runor install dev tools.
Commands
- Python setup:
cd services && uv sync --all-packages. - Python lint:
cd services && uv run ruff check bff logic. - Import-check services with the shared venv from each service dir, e.g.
services/.venv/bin/python -c "from app.main import app; print(app.title)"with cwdservices/bfforservices/logic. - Frontend uses pnpm
10.12.1; ifpnpmis unavailable, usenpx pnpm@10.12.1 .... - Frontend checks from repo root:
npx pnpm@10.12.1 --filter train-watcher-frontend lint,typecheck, andbuild. - Full local stack:
docker compose -f infra/docker-compose.yml up --build.
Docker And Infra Gotchas
- Compose intentionally uses
host.docker.internalfor BFF/logic/Postgres/MinIO/frontend proxy paths; do not casually switch these back to service DNS names without testing Docker DNS on this machine. - Backend Docker build context is
services/, withbff/Dockerfileandlogic/Dockerfile; both install runtime deps fromservices/uv.lockand start/app/.venv/bin/uvicorndirectly. services/.dockerignoreexcludes.venv,.ruff_cache,.pytest_cache,.ty, and__pycache__; do not delete these local artifacts just to clean Docker contexts.- MinIO uses the named volume
minio-object-data; the olderminio-dataname was abandoned after corrupted local state. - Frontend API base defaults to
/api;frontend/nginx.confproxies/api/to the BFF port.
Backend Details
- Both Python apps auto-create SQLAlchemy tables on startup via
create_schema; Alembic migrations exist but are not run by Compose startup yet. - Logic internal endpoints require
X-Service-TokenandX-User-Id; BFF is responsible for supplying both. - BFF stores uploaded images in MinIO/S3 and passes
image_s3_urlplusimage_s3_keyto logic catalog records.