🏆 Football League Simulation & Predictions Dashboard
A high-performance, interactive Football League Simulation and Forecasting application. The project features a Go-powered backend with SQLite storage, a strength-based Poisson match simulation engine, a 10,000-run Monte Carlo championship predictor, and a sleek, premium glassmorphic dark-theme Single-Page App (SPA).
🚀 Key Features
- Double Round-Robin Schedule: Mathematically balanced 6-week schedule (12 matches total) seeded automatically on startup.
- Dynamic Standings Calculations: Recalculates Points, Wins, Draws, Losses, and Goal Differences instantly via an aggregate SQL query.
- Poisson-Distribution Match Simulation: Employs realistic scoring mechanics based on relative team strengths and a home-advantage factor.
- Monte Carlo Prediction Engine: Simulates the remaining season 10,000 times in milliseconds to calculate precise, live championship probabilities after Week 4.
- Interactive Score Editing: Type a custom score directly into any match card, and watch the entire league table and predictions update instantly!
- Premium Glassmorphic UI: Gorgeous dark mode featuring micro-animations, team-colored accent progress bars, and full responsiveness.
- Zero-Dependency SQLite: Uses a pure Go CGO-free driver (
github.com/glebarez/go-sqlite) for compilation and portability on Windows without GCC.
🛠️ Tech Stack
- Backend: Go (Golang) 1.22+ (using standard HTTP router,
go:embed, and standard loggers) - Database: SQLite (CGO-free driver)
- Frontend: Single-Page App (SPA) built with Semantic HTML5, Vanilla CSS3 (Custom properties, grid/flex layouts, glassmorphic filters), and Vanilla JS ES6.
- Testing: Go unit tests with in-memory SQLite mocks.
📂 Project Structure
├── static/ # Static Web Assets (Frontend)
│ ├── index.html # Dashboard HTML5 Skeleton
│ ├── style.css # Glassmorphic Dark-Theme Stylesheet
│ └── app.js # UI binding & REST API integrations
├── db.go # SQLite database config and embedding migrations
├── models.go # Domain structs (Team, Match, Standing, Prediction)
├── repository.go # Data Access Layer & aggregate standings calculation
├── simulation.go # Poisson-distribution match simulator
├── predictor.go # Monte Carlo prediction engine (10,000 iterations)
├── main.go # API endpoints, CORS support, static router & listeners
├── schema.sql # Database schemas and double-round robin fixtures seed
└── simulation_test.go # Comprehensive test suite for services and database
💻 Local Setup & Execution
1. Run Automated Tests
Verify services, standings math, and prediction engine boundaries:
go test -v ./...
2. Start the Server
Build and run the Go server locally:
go run .
Open your browser and navigate to: 👉 http://localhost:8080
☁️ Deployment Guide
Option A: Monolithic Deployment (Recommended)
You can deploy the entire application as a single self-contained unit to Render, Railway, Fly.io, or any VPS.
- The backend binary automatically compiles, bundles, and serves the static files inside the
static/directory. - This preserves the SQLite
league.dbfile locally, making state persistent and configuration-free.
Option B: Cloudflare Pages (Frontend) + Render/Railway (Backend)
You can split the stack by hosting the static UI on Cloudflare Pages and the Go API backend on Render or Railway. We have equipped the Go server with built-in CORS support to allow cross-origin requests.
1. Deploy Frontend on Cloudflare Pages
- Push this repository to GitHub.
- In the Cloudflare Dashboard, go to Workers & Pages -> Create Application -> Pages -> Connect to Git.
- Select this repository.
- In Build settings:
- Framework preset:
None - Build command:
sed -i "s|%%API_BASE%%|${API_BASE}|g" static/app.js - Build output directory:
static
- Framework preset:
- Go to the Environment variables tab under your Pages project settings and add:
- Variable name:
API_BASE - Value:
https://your-go-backend-domain.com(your remote backend URL)
- Variable name:
- Click Save and Deploy. (Cloudflare will automatically inject your environment variable during compilation!)
2. Deploy Go Backend (Render / Railway)
- Deploy the backend to Render/Railway. They will automatically detect the
go.modfile and build it. - Set the listening port using
PORTenvironment variable or let it default to8080.
3. Local/Developer Override (Optional)
If you want to override the API base URL locally without redeploying, the app still supports browser overrides:
- Open your browser’s Developer Tools (F12).
- Run the following command in the JavaScript Console:
localStorage.setItem('API_BASE', 'http://localhost:8080'); - Clear it by running
localStorage.removeItem('API_BASE').
Auto-generated from the GitHub repository.