An AI-powered Fantasy Premier League advisor that recommends transfers, evaluates hit strategies, and signals wildcard timing — using live FPL data and Claude AI.
What it does
- My Squad — loads your 15 players via your FPL Manager ID, shows prices, points, form, and injury status
- Transfers — formula-ranked upgrade suggestions with an AI analysis button per player (Claude reasons about fixtures, form, and injury risk)
- Strategy — AI recommends whether to use your free transfer, take a -4 hit, or bank for next week, with ranked priority transfers
- Wildcard — compares your squad score vs an optimal squad and signals when to pull the trigger
- Settings — on-demand data refresh (pulls latest FPL data without any cron job)
Stack
data/ Python — fetches FPL API, writes to SQLite
backend/ Node.js + Express — reads DB, serves REST API, calls Claude
frontend/ React + Vite — dashboard UI
Prerequisites
- Node.js 18+
- Python 3.9+
- An Anthropic API key → console.anthropic.com
Setup
1. Clone and install
git clone <your-repo-url> cd fpl-intelligence
Python layer:
cd data python3 -m venv venv source venv/bin/activate # Windows: venv\Scripts\activate pip install requests pandas scikit-learn aiohttp fpl
Node backend:
React frontend:
2. Add your API key
# backend/.env
ANTHROPIC_API_KEY=sk-ant-your-key-here
PORT=30013. Run the data pipeline (once per gameweek)
cd data source venv/bin/activate python pipeline.py # takes ~2 minutes, populates data/db/fpl.db
4. Start the servers
Open three terminals:
# Terminal 1 — backend cd backend && npm run dev # Terminal 2 — frontend cd frontend && npm run dev
Open http://localhost:5173, enter your FPL Manager ID and hit Load.
Finding your Manager ID
Go to fantasy.premierleague.com → click Points → the number in the URL is your ID:
fantasy.premierleague.com/entry/1234567/event/...
^^^^^^^
Mobile (same WiFi)
# Find your machine's local IP ipconfig getifaddr en0 # Mac # e.g. 192.168.1.42
Create frontend/.env.local:
VITE_API_URL=http://192.168.1.42:3001/api
Make sure vite.config.js has host: true and backend/index.js listens on 0.0.0.0. Then open http://192.168.1.42:5173 on your phone.
API endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/my-team/:managerId |
Your 15 players for the current GW |
| GET | /api/free-transfers/:managerId |
Free transfers banked + made this GW |
| POST | /api/transfers |
Formula-ranked transfer suggestions |
| POST | /api/ai-transfers |
Claude analysis for a specific player swap |
| POST | /api/strategy |
Full transfer strategy (hits, banking, priority order) |
| POST | /api/wildcard |
Wildcard signal vs optimal squad |
| GET | /api/fixtures |
All fixtures with team names and FDR |
| GET | /api/value |
Top 50 players by points per million |
| POST | /api/refresh |
Triggers Python pipeline to refresh DB data |
How the AI works
The formula (form, points-per-game, ICT index, availability) narrows candidates first. Claude then receives the player's stats, the top alternatives, and both teams' next 5 fixtures — and reasons about whether the transfer is worth making, flagging rotation risk, injury news, and fixture swings. The strategy endpoint additionally factors in your exact free transfer count (calculated from your full transfer history) to decide whether a -4 hit is worth taking.
Project structure
fpl-intelligence/
├── data/
│ ├── venv/ # Python virtual environment (gitignored)
│ ├── db/
│ │ ├── setup.py # Creates SQLite schema
│ │ └── fpl.db # SQLite database (gitignored)
│ ├── fetchers/
│ │ └── fpl_api.py # FPL API calls
│ └── pipeline.py # Orchestrates fetch + store
├── backend/
│ ├── index.js # Express API + Claude integration
│ ├── .env # API keys (gitignored)
│ └── package.json
├── frontend/
│ ├── src/
│ │ ├── App.jsx # Main app, routing, squad/wildcard tabs
│ │ ├── TransferCard.jsx # Per-player transfer card with AI button
│ │ └── StrategyPanel.jsx # Full strategy tab
│ ├── .env.local # Local overrides e.g. VITE_API_URL (gitignored)
│ └── vite.config.js
└── README.md
Refreshing data
No cron needed. Go to the Settings tab in the UI and hit Refresh FPL data. It triggers the Python pipeline on demand — run it at the start of each gameweek after the deadline.