Fantasy is a local-first dynasty fantasy football intelligence app with:
- a FastAPI backend for ingestion, analytics, and decision engines
- a React + Vite frontend for dashboards, trade tools, draft room, and portfolio views
- a DuckDB data store persisted at
data/fantasy.duckdb
backend- FastAPI service, ingestion workflows, valuation/intelligence logic, Alembic migrations, Python testsfrontend- React 19 + TanStack Router + React Query UIdata- local database and data artifacts
- Backend: Python 3.12+, FastAPI, SQLAlchemy, Alembic, DuckDB
- Frontend: React 19, TypeScript, Vite, TanStack Router, React Query, Tailwind CSS
- Python 3.12+
- Node.js 20+ and npm
uv(recommended for backend dependency management)
cd backend
uv sync
uv run alembic upgrade head
uv run uvicorn fantasy.main:app --reloadThe API runs at http://localhost:8000.
In a second terminal:
cd frontend
npm install
npm run devThe app runs at http://localhost:5173.
The Vite dev server proxies /api/* to http://localhost:8000, so local frontend requests work without extra API host configuration.
Run tests:
cd backend
uv run pytestUseful backend environment variables (loaded from repo root .env when present):
FANTASY_DB_PATH(default:data/fantasy.duckdb)FANTASY_PORTFOLIO_OWNER_DISPLAY_NAMEFANTASY_PORTFOLIO_OWNER_IDFANTASY_DEV_AUTO_REFRESH(true/false)FANTASY_DEV_AUTO_REFRESH_LEAGUES(comma-separated league IDs)FANTASY_DEV_AUTO_REFRESH_INGEST_MODE(skip,incremental,full)FANTASY_DEV_AUTO_REFRESH_SNAPSHOTS(true/false)
For dev auto-refresh behavior and personalization examples, see backend/README.md.
Build and type-check:
cd frontend
npm run buildApply latest migrations:
cd backend
uv run alembic upgrade headCreate a new migration:
cd backend
uv run alembic revision -m "describe change"