Remove boilerplate, directory tree listing, and discoverable architecture docs. Keep commands, key patterns, env vars, and important gotchas. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1.5 KiB
1.5 KiB
Major Domo Database API
FastAPI backend serving SBA fantasy league data. Peewee ORM with PostgreSQL.
Commands
docker-compose up # Start PostgreSQL + API + Adminer
docker-compose up --build # Rebuild and start
docker-compose --profile sync up sync-prod # One-time production data sync
python migrations.py # Run migrations (SQL files in migrations/)
- Dev server:
10.10.0.42| Adminer:http://10.10.0.42:8080 - Production:
ssh akamai→cd container-data/sba-database
Architecture
- Routers: Domain-based in
app/routers_v3/under/api/v3/prefix - ORM: Peewee — always specify
Meta.table_nameto match PostgreSQL naming - Auth: OAuth2 bearer token via
API_TOKENenv var - Error handling:
@handle_db_errorsdecorator (logging, rollback, HTTP errors) - POST models: Use
Optional[int] = Noneforidfields (DB auto-generates) - Logging: Rotating file handler (
/tmp/sba-database.log, 8MB max, 5 backups)
Environment Variables
Required: API_TOKEN, POSTGRES_HOST, POSTGRES_DB, POSTGRES_USER, POSTGRES_PASSWORD
Optional: POSTGRES_PORT (5432), LOG_LEVEL (WARNING), PRIVATE_IN_SCHEMA
Important
- All active code is in
/app— root-levelmain.py,db_engine.pyare legacy, not in use - PostgreSQL only (no SQLite fallback)
- Migrations are SQL files in
migrations/, applied manually via psql - API docs auto-generated at
/api/docs