major-domo-database/CLAUDE.md
Cal Corum 904bf3ea49
Some checks failed
Build Docker Image / build (pull_request) Has been cancelled
docs: Add subdirectory CLAUDE.md files for routers, stratplay, and services
Provide targeted context for each app subdirectory so Claude Code
understands local patterns without relying on the root CLAUDE.md.
Also simplifies root CLAUDE.md dev/prod environment sections.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 15:22:33 -06:00

1.5 KiB

Major Domo Database API

FastAPI backend serving SBA fantasy league data. Peewee ORM with PostgreSQL.

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)

Development Environment

  • Dev server location: 10.10.0.42
  • Start all services: docker-compose up (PostgreSQL + API + Adminer)
  • Pull and start: docker-compose pull && docker-compose up --build (rebuilds image with latest changes)
  • Sync from production: docker-compose --profile sync up sync-prod (one-time production data sync)

Production Environment

  • Production deployment: Uses same docker-compose up workflow
  • Production server access: ssh akamai then cd container-data/sba-database

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
  • NEVER run or test against the local docker compose — always deploy to and test against the dev server (10.10.0.42:814). The local container has no meaningful data.