FergieTime is an AI-assisted Fantasy Premier League (FPL) manager application designed to optimize weekly decisions under budget and transfer constraints. By combining statistical and machine learning models for player point predictions with an exact integer linear programming (ILP) optimizer, the application recommends transfer, captaincy, and starting lineup actions. An LLM-powered explanation engine synthesizes relevant news and details the underlying rationale for every decision. FergieTime also features automated deadline alerting and optional, guarded auto-submission to the FPL API when users are inactive near gameweek deadlines.
Per CLAUDE.md, the repository structure is:
frontend/: Next.js web application (TypeScript, App Router).backend/: FastAPI backend and core ML/optimization scripts.api/: REST endpoints.agent/: LLM tool-calling agent.optimization/: ILP optimizer.models/: Point prediction models.ingestion/: FPL API ingestion client and sync logic.tasks/: Celery tasks and scheduling.db/: Database schemas and migrations.
tests/: Unit, integration, and backtest suites.infra/: Local deployment infrastructure (Docker Compose, Dockerfiles).docs/: Design and architectural documentation.
- Python 3.11+
- Node.js 18+ and npm
- Docker and Docker Compose
You can run the FastAPI backend, Postgres database, and Redis cache together using Docker Compose:
- Navigate to the
infra/directory:cd infra - Build and start the services:
This will spin up:
docker compose up --build
- API Service on
http://localhost:8000(health check athttp://localhost:8000/health) - Postgres Database on port
5432(persisted viapostgres_datavolume) - Redis Cache on port
6379
- API Service on
- Navigate to the
backend/directory:cd backend - Create and activate a virtual environment:
python -m venv .venv # Windows: .venv\Scripts\activate # macOS/Linux: source .venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
- Start the backend development server:
The health check will be live at
uvicorn api.main:app --reload
http://127.0.0.1:8000/health.
- Navigate to the
frontend/directory:cd frontend - Install dependencies:
npm install
- Start the development server:
The web application will be live at
npm run dev
http://localhost:3000.