F1-Zoom is a multi-service project for Formula 1 data, visualization, and predictions.
It includes:
- A React + Vite frontend
- A Spring Boot backend API
- A FastAPI prediction service (LightGBM)
- A FastAPI live timing service (mock or live SignalR feed)
- A Python data pipeline for collecting and writing race/session data
Typical app flow:
- Frontend (
frontend) onhttp://localhost:5173 - Backend (
backend) onhttp://localhost:8080 - Prediction service (
Data/Simulation) onhttp://localhost:8000 - Live timing service (
live_service) onhttp://localhost:8000by default
Important port note:
prediction_service.pyandlive_service/main.pyboth default to port8000.- Run one at a time on
8000, or move one service to another port and update callers/proxy config.
F1-Zoom/
├── backend/ # Spring Boot API (Java 21, Maven wrapper)
│ ├── src/main/java/
│ ├── src/main/resources/
│ ├── pom.xml
│ └── mvnw
├── frontend/ # React + TypeScript + Vite app
│ ├── src/
│ ├── public/circuit_3d/ # Track CSV/JS assets + converters/generators
│ └── package.json
├── Data/Simulation/ # LightGBM model training + FastAPI prediction API
│ ├── lightgbm_model.py
│ ├── prediction_service.py
│ ├── requirements.txt
│ └── README.md
├── live_service/ # FastAPI SSE service for live/mock timing
│ ├── main.py
│ ├── mock.py
│ ├── f1_client.py
│ └── requirements.txt
├── data_pipeline/ # Supabase/FastF1 ETL and feature generation scripts
│ ├── orchestrator.py
│ ├── db/
│ ├── fetchers/
│ └── requirements.txt
├── .env.example # Required environment variable template
└── README.md
Install these first:
- Java 21+
- Node.js 18+ and npm
- Python 3.11+ (Conda recommended)
- Maven is optional if you use
./mvnw
Copy and fill environment values:
cp .env.example .envRequired for Supabase-backed features:
SUPABASE_URLSUPABASE_SERVICE_ROLE_KEY
cd backend
./mvnw clean installRun backend:
./mvnw spring-boot:runBackend API base path is /api/v1 (for example /api/v1/test).
cd frontend
npm install
npm run devFrontend runs at http://localhost:5173.
Vite proxy is configured to:
/api/realtime->http://localhost:8000/api/state->http://localhost:8000/api->http://localhost:8080
If using conda:
conda create -n f1-project python=3.11 -y
conda activate f1-projectInstall deps:
cd Data/Simulation
pip install -r requirements.txtTrain model (first run):
python lightgbm_model.pyStart prediction API:
python prediction_service.pyPrediction service endpoints include:
/health/predict/next-race/predict/full
Install deps:
cd live_service
pip install -r requirements.txtRun in mock mode (default):
uvicorn main:app --reload --host 0.0.0.0 --port 8000Run in live mode (official feed):
F1_MODE=live uvicorn main:app --reload --host 0.0.0.0 --port 8000Useful env vars:
F1_MODE=mock|liveTRACK_NAME=Melbourne(mock track)TRACK_DATA_DIR=/path/to/TrackCoordinateJS
Install deps:
cd data_pipeline
pip install -r requirements.txtRun orchestrator from project root:
cd ..
python -m data_pipeline.orchestratorTerminal 1:
cd backend
./mvnw spring-boot:runTerminal 2:
cd Data/Simulation
python prediction_service.pyTerminal 3:
cd frontend
npm run devTerminal 1:
cd backend
./mvnw spring-boot:runTerminal 2:
cd live_service
uvicorn main:app --reload --host 0.0.0.0 --port 8000Terminal 3:
cd frontend
npm run devConvert all CSV tracks to JS assets:
cd frontend/public/circuit_3d
python csv_reading.pyGenerate missing track CSVs from FastF1:
cd frontend/public/circuit_3d
python generate_missing_track_csvs_fastf1.pyCompare generated Melbourne variant against current baseline:
cd frontend/public/circuit_3d
python compare_melbourne_fastf1.pyBackend:
cd backend
./mvnw test
./mvnw clean packageFrontend:
cd frontend
npm run lint
npm run build
npm run preview- Supabase credentials are required for data pipeline ingestion and some backend circuit/session endpoints.
- If you see connection failures from backend prediction endpoints, ensure
Data/Simulation/prediction_service.pyis running on port8000. - If you use
live_serviceon a different port, updatefrontend/vite.config.tsproxy and any backend hardcoded URLs as needed. `