FIFA Predictor
Live insights and match predictions
About
FIFA World Cup Predictor
This application is a full-stack World Cup prediction system that combines historical football data, Elo-based statistical modelling, and live match updates to generate tournament predictions and insights.
Data Sources
The system aggregates football data from multiple sources to build a reliable dataset for predictions:
- Kaggle dataset: used for historical international match results and baseline statistical data.
- football-data.org API: provides live tournament fixtures, scores, and match status updates.
- Data is stored in PostgreSQL to avoid repeated API calls and to maintain a local historical record.
Prediction Model
Predictions are generated using a deterministic Elo-based rating system:
- Elo ratings: each team has a stored rating in PostgreSQL representing relative strength.
- Expected outcome formula: converts rating differences into win probabilities.
- Rule-based score mapping: probability thresholds determine final predicted scorelines.
Predictions are precomputed and stored in the database rather than generated on every request.
How Predictions Work
Predictions are generated using an Elo-based rating system trained on historical match data.
Team ratings are initially set to 1500 Elo and then calibrated using a bootstrap process, which replays historical match results chronologically. Each match updates team strength using the standard Elo update formula, with a fixed K-factor of 32.
Once trained, these ratings are stored in PostgreSQL and used as the foundation for live predictions.
For upcoming fixtures, the system calculates expected outcomes using the Elo probability formula, converting rating differences into win probabilities. These probabilities are then mapped into deterministic scorelines using a rule-based threshold system.
This ensures predictions are both explainable and consistent, while still reflecting long-term team performance trends derived from historical data.
System Architecture
The system is designed as a full-stack, data-driven application with a clear separation between ingestion, prediction, and presentation layers.
- NestJS backend handles match ingestion, prediction generation, and scheduled refresh logic.
- NextJS frontend provides a responsive dashboard for predictions, match tracking, and analytics.
- PostgreSQL database acts as both a persistent store and a caching layer for API data and predictions.
- Docker Compose orchestrates services for consistent local and production deployment.
Data Refresh & Optimisation
To manage external API limitations and ensure performance, the system uses a hybrid refresh strategy:
- Match and team data are cached in PostgreSQL to reduce dependency on repeated API requests.
- An hourly scheduler performs full dataset synchronisation.
- During active matches (TIMED / IN_PLAY), the system enters a short-interval refresh cycle.
- Once matches are FINISHED, live polling stops automatically and the system reverts to hourly updates.
Tech Stack
- • NestJS (backend API + scheduler)
- • NextJS (frontend UI)
- • Tailwind CSS (styling)
- • PostgreSQL (data storage + caching)
- • Docker Compose (deployment orchestration)
- • football-data.org API (live match data)
- • Kaggle datasets (historical training data)