An official-seeming court website for The Ringer Fantasy Football Show's Fantasy Court podcast segment. Uses AI to transcribe episodes, extract fantasy football dispute cases, and generate legal-style opinions with a Next.js static site generated by a Python / PostgreSQL backend.
- uv (
curl -LsSf https://astral.sh/uv/install.sh | sh) - just task runner (
uv tool install rust-just) - Node.js 22+
- pnpm (
npm install -g pnpm) - PostgreSQL
- Redis
For deployment:
- Docker/Docker Compose
git clone https://github.com/ProbablyFaiz/fantasy_court.git fantasy_court
cd fantasy_courtjust installThis installs:
- Pre-commit hooks (will also install
pre-commitas a user-wideuvtool) - Python dependencies in a virtual environment via
uv - Frontend-static dependencies via
pnpm
If you need more granular control over your environment setup, see the just install definition in Justfile for a starting point.
cp template.env .env
mkdir dataEdit .env and fill in the variables:
- Set
DATA_ROOTto the absolute path of yourdatadirectory - Configure PostgreSQL connection details
- For database credentials, use the helper scripts in
infra/to create users:./infra/create_admin_db_user.fish <your_admin_user> fantasy_court ./infra/create_api_db_user.fish <your_api_user> fantasy_court
Backend:
just apiBackend API will be available at:
- Backend API: http://localhost:8203
- API Docs: http://localhost:8203/docs
Frontend (Static Site): The frontend is a statically generated Next.js site. To build it locally:
cd frontend-static
pnpm run buildTo ensure all tests are passing, run:
just api- Start FastAPI backend server
just lint- Run pre-commit hooks (formatting, linting)just typecheck- Run TypeScript type checking on frontend-static
To run frontend tests:
just test-frontend
# Or, to run a specific test file:
just test-frontend <path to test file, relative to frontend-static/>
# E.g.,
just test-frontend src/components/AudioPlayer.test.tsxTo run backend tests:
just test-backend
# Or, to run a specific test file:
just test-backend <path to test file, relative to backend/>
# E.g.,
just test-backend test/api/test_tasks_api.pyTo run all tests:
just test-alljust migrate "description"- Generate new Alembic migrationjust migrate-up- Apply pending migrationsjust migrate-down- Rollback last migration
just- Show all available commandsjust install- Install all dependencies (frontend + backend)
The Fantasy Court pipeline runs as a scheduled Celery task that:
- Ingests new podcast episodes from the RSS feed
- Downloads episode audio files to S3
- Detects and transcribes Fantasy Court segments
- Extracts cases and drafts judicial opinions using AI
- Exports opinions to JSON format
- Builds the Next.js static site
- Deploys to Cloudflare Pages
See court/pipeline/commands.py for the full pipeline implementation.
├── backend/ # FastAPI backend
│ ├── court/ # Main package
│ │ ├── api/ # API routes & endpoints
│ │ ├── db/ # Database models, sessions & migrations
│ │ ├── inference/ # AI inference scripts (segments, cases, opinions)
│ │ ├── ingest/ # Episode ingestion & processing
│ │ ├── export/ # Data export utilities
│ │ ├── pipeline/ # Automated pipeline orchestration
│ │ ├── jobs/ # Background job processing (Celery)
│ │ └── utils/ # Shared utilities (observability, storage)
│ ├── test/ # Backend tests
│ └── pyproject.toml # Python dependencies
├── frontend-static/ # Next.js static site
│ ├── src/
│ │ ├── pages/ # Next.js pages
│ │ ├── components/ # React components
│ │ └── client/ # Generated API client types
│ ├── public/ # Static assets
│ │ └── data/ # JSON data for static generation
│ └── package.json # Frontend dependencies
├── docs/ # Documentation
├── infra/ # Infrastructure scripts (DB setup)
├── .github/workflows/ # CI/CD workflows
├── docker-compose.yml # Multi-container setup
└── Justfile # Task automation
Frontend:
- Next.js (Static Site Generation) + React + TypeScript
- Tailwind CSS for styling
- openapi-ts for API client type generation
Backend:
- FastAPI
- SQLAlchemy 2.x ORM + Alembic migrations
- PostgreSQL database
- Pydantic 2.x for data validation
Observability:
- Sentry for error tracking on both frontend and backend (optional)
Tools:
- just for task automation
- pnpm for frontend package management
- uv for Python dependency management
- Pre-commit hooks with Ruff (Python) and Biome (TypeScript/JavaScript)
Production Deployment:
- Docker/Docker Compose for backend services
- Cloudflare Pages for static site hosting
- Automated pipeline via Celery for content processing and deployment