
FPL Analytica — Real-Time FPL Analytics Platform
A full-stack statistics and optimization platform for Fantasy Premier League managers, featuring progressive rendering, scheduled ETL pipelines, and repository-pattern tiered caching.
5 of 19 fully live
Live Pages
53 audited
API Endpoints
< 500ms target
Core Latency
152 frontend commits
Commits
Project Overview
FPL Analytica is a data-driven web application designed to solve the informational void in the official Fantasy Premier League (FPL) platform. By combining a React SPA on the frontend, a Python/FastAPI service on the backend, scheduled ETL scraping pipelines, and an Azure SQL Database, the application provides manager identity trends, live gameweek standing updates, and multi-second optimization solves without blocking performance. The platform processes millions of data points from the official FPL API using decoupled pipeline scripts (`fpl_data_harvesting_pipeline.py`) that run on schedules and land CSV files in Azure Blob Storage before loading them into Azure SQL Database. The backend enforces a strict repository pattern via `app/data_access/repository.py` to cache queries (with custom TTLs like 120s for mini-leagues and 900s for chip indices) and isolate expensive season-long computations from low-latency identity reads.
Key Challenges
Balancing slow analytics against fast reads
Optimality and chip-timing calculations are extremely expensive, taking 5 to 30 seconds to complete. Running these queries synchronously would block simple reads and freeze the dashboard.
Decoupling live FPL API rate limits
Querying the official FPL API live on every user request is not viable at scale due to strict rate limits and external API downtime during gameweeks.
Enforcing backend architecture boundaries
In large-scale designs, developers often inadvertently import database layer functions directly into API route handlers, eroding the repository pattern boundary over time.
Handling breaking API spec updates
The backend API contract underwent a major breaking change mid-project (introducing /api/ prefixes and renaming/removing 30+ endpoints), threatening frontend integration.
Solutions Implemented
Tiered progressive loading strategy
Implemented a progressive API design that returns immediate dashboard data (<500ms), fetches live standings in the background, and lazy-loads heavy analytical calculations.
- Immediate tier (/dashboard/core/{id}) serves manager identity and rank trend
- Fast background tier (/dashboard/live/{id}) loads live fixtures and top-1000 benchmarks
- Lazy-load tier (/dashboard/analytics/{id}) streams optimality solvers and chip timing
- Ensures the dashboard remains interactive immediately while computations run
Scheduled scraping and CSV staging
Built automated ingestion pipelines (*_pipeline.py) that harvest live data on a cron schedule and stage it as CSV files in Azure Blob Storage.
- Decouples the web application entirely from live third-party API availability
- Allows heavy optimization algorithms to run against consistent, versioned snapshots of the season
- Drastically reduces outbound API call frequency, preventing rate limit blocks
Mechanical import verification script
Wrote a custom linting script (check_api_imports.py) that runs in the CI/CD pipeline before every PR merge to verify import paths.
- Scans backend endpoint files to block direct database function imports
- Ensures all endpoints only communicate with the repository.py layer
- Maintains clean layer separation and enables backend storage swapability
Traceability matrix and API spec audits
Authored and maintained API_MAPPING.md and CONTENT_MAPPING.md as living integration matrices, performing systematic audits.
- Mapped all 53 backend endpoints against the 39 frontend query wrapper functions
- Instantly highlighted mismatched route parameters, deprecated calls, and dead paths
- Saved weeks of manual debugging by establishing contract-first verification
Technology Stack
frontend
backend
database
devops
Development Process
Spec & Matrix Mapping
4 weeks- Created page-by-page UI specifications in CONTENT_MAPPING.md
- Drafted API_MAPPING.md traceability matrix connecting UI to backend contracts
- Designed the developer onboarding roadmap and environment setup guidelines
Ingestion Pipelines & Repository
6 weeks- Wrote scheduled scraper scripts (fpl_data_harvesting_pipeline.py)
- Set up Azure SQL database schemas and Azure Blob Storage CSV landing path
- Implemented repository and cache layers with custom TTL timings
Tiered API & Security
8 weeks- Built FastAPI progressive endpoints (Immediate, Fast, Lazy) with response isolation
- Configured JWT authentication headers and CORS origin restrictions
- Implemented GDPR/privacy consent and deletion endpoints
Frontend Core Pages
6 weeks- Initialized Vite + TypeScript client app and integrated TanStack Query and Redux Toolkit
- Built and styled the 5 core pages: Dashboard, Precision, and Manager/Mini-League/Elite tracking
- Implemented list virtualization for large player tables using @tanstack/react-virtual