major-domo-database/CLAUDE.md
Cal Corum d95af4ed90 Optimize CLAUDE.md from 116 to 37 lines
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>
2026-02-14 08:30:37 -06:00

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 akamaicd container-data/sba-database

Architecture

  • Routers: Domain-based in app/routers_v3/ under /api/v3/ prefix
  • ORM: Peewee — always specify Meta.table_name to match PostgreSQL naming
  • Auth: OAuth2 bearer token via API_TOKEN env var
  • Error handling: @handle_db_errors decorator (logging, rollback, HTTP errors)
  • POST models: Use Optional[int] = None for id fields (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-level main.py, db_engine.py are 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