ANALYZIZ (adnaizf1) is a full-stack Formula 1 telemetry, live timing, and championship analytics web application built for the FIA Formula 1 World Championship.
It combines a FastAPI backend (FastF1, OpenF1, native SignalR live-timing stream, Redis + disk SWR cache) with a React 19 + TypeScript + Tailwind CSS v4 frontend designed around a broadcast timing-tower interface.
- Core Capabilities
- System Architecture
- Tech Stack
- Repository Structure
- Quick Start
- Verification & CI
- API Reference
- License & Disclaimer
- SignalR WebSocket Stream (
/ws/livetiming): Consumes Formula 1 timing feeds directly with automatic reconnection, gzip payload decoding, per-IP connection caps, and background JSON serialization. - Canonical Vector Circuit Maps: 24 vectorized circuit layouts rendered via SVG path geometry (
getPointAtLength()) with interactive corner badges, sector splits, and DRS / Active Aero zones. - Previous Session & Simulator Modes: Switches between active live timing, the last completed session classification (
/api/livetiming/previous), an interactive pit-wall physics demo (?sim=1), and a transparent 1920x1080 OBS stream overlay (/overlay/live). - Team Radio Player: Streams
.mp3pit-wall transmissions with keyboard-seekable progress sliders, variable playback speed, driver filtering, and automatic failover between SignalR captures and OpenF1 archives.
- Up to 5-Driver Overlaid Traces: Compares Speed, Throttle, Brake, and Time Delta channels aligned over circuit distance (
0to full lap length). - Synchronized Distance Crosshair & Track Domination Map: Scrubbing any chart updates all sibling traces and highlights micro-sector ownership around the circuit.
- Two-Source Session Details: Reads official FastF1 session archives first and fills missing lap-derived blocks (stints, speed traps, sector matrix, weather, lap/gap charts) from OpenF1 when FastF1's archive has not published lap timing yet.
- WDC & WCC Standings (
/stats,/drivers,/teams): Sortable championship tables with mathematical title-clinch / elimination badges and a cumulative points progression worm chart. - Driver & Constructor Profiles (
/driver/:id,/team/:id) & H2H Duel (/compare): Teammate qualifying and race head-to-head bars, normalized radar attributes, round-by-round logs, and Sprint/GP DNF & DNS breakdowns. - Title Simulator (
/simulator), Ghost Race (/ghost), & Watch-Party Bingo (/bingo): FIA 2025/2026 points simulator (25-point GP win, 8-point Sprint win, no fastest-lap bonus point), dual-car SVG lap replay, and deterministic race-day bingo cards. - Command Palette (
Ctrl+K/Cmd+K): Keyboard-navigable search across pages, drivers, constructors, and season rounds with diacritic normalization (perezmatchesSergio PΓ©rez).
- Single-Flight SWR Cache (
config/cache.py): Coalesces concurrent cold misses per cache key, serves stale-while-revalidate responses during background refreshes, sanitizesNaN/Infinityvalues before atomic temp-file renames, and refuses to cache upstream error payloads. - Proxy-Safe Rate Limiting (
config/limiter.py): TrustsX-Forwarded-For/X-Real-IPonly when the peer IP belongs toTRUSTED_PROXIES, with automatic in-memory fallback if Redis is unavailable. - Constant-Time Admin Auth (
utils/auth.py): Protects cache invalidation (/api/clear_cache/{year}) and forced upstream refreshes (?refresh=true) with UTF-8 bytesecrets.compare_digestchecks onX-API-Key. - Strict Security Headers: Enforces
script-src 'self',object-src 'none',frame-ancestors 'none',X-Content-Type-Options: nosniff,Referrer-Policy, and productionStrict-Transport-Securityacross both FastAPI and Nginx, including 4xx/500 error responses.
[ F1 SignalR Live Stream / FastF1 / OpenF1 ]
|
v
+----------------------+ +-----------------------+ +----------------------+
| React 19 + Vite 7 | <----> | FastAPI (Python 3.11+)| <----> | Redis 7 + Disk SWR |
| TypeScript 5.7 + TW4 | REST | Single-Flight Cache | I/O | Atomic JSON Store |
| Recharts + SVG Maps | & WS | SlowAPI + Auth Guards | | FastF1 HTTP Cache |
+----------------------+ +-----------------------+ +----------------------+
^ ^
| |
[ Web Client ] [ Nginx Microcache :80 ]
| Layer | Technologies |
|---|---|
| Frontend | React 19.1, TypeScript 5.7, Vite 7.3, Tailwind CSS 4.3, Framer Motion, Lucide React |
| Charts & Maps | Recharts 3, D3 utilities, canonical SVG circuit paths & corner layout solver |
| Client State | TanStack React Query 5, React Router 7, native Fetch & WebSocket clients |
| Backend | FastAPI, Python 3.11+, Uvicorn, Pydantic v2, HTTPX, Loguru, Sentry SDK |
| Data Sources | FastF1 3.7, OpenF1 REST API, Formula 1 SignalR WebSocket feed, official standings scraper |
| Caching & Infra | Redis 7, atomic file-backed SWR cache, Nginx reverse-proxy microcache, Docker Compose |
| Quality Gates | Vitest, Testing Library, ESLint 9 (react-hooks + typescript-eslint), Ruff (E9,F,B), unittest |
adnaizf1/
βββ .github/workflows/ci.yml # Frontend, Backend, and Docker Compose CI jobs
βββ AGENTS.md # Developer and coding-agent workflow notes
βββ README.md # Project documentation
βββ F1-Fullstack-project/
βββ DESIGN.md # UI typography, color tokens, and interaction rules
βββ docker-compose.yml # Redis + FastAPI backend + Nginx frontend stack
βββ Backend/
β βββ Dockerfile # Multi-stage non-root Python 3.11 container
β βββ main.py # FastAPI lifespan, CORS, security headers, routers
β βββ pyproject.toml # Ruff linter configuration (E9, F, B)
β βββ requirements.txt # Locked Python dependencies
β βββ config/ # SWR cache, rate limiter, Loguru/Sentry setup
β βββ routers/ # dashboard, championship, standings, races, race_details,
β β # profiles, telemetry, team_radio, livetiming, system
β βββ services/ # FastF1, OpenF1 fallback, SignalR, scraper, circuit maps
β βββ utils/ # API key authentication helper
β βββ tests/ # Contract, coalescing, security, and service unit tests
βββ frontend/
βββ Dockerfile # Node 22 build stage + Nginx Alpine runtime
βββ nginx.conf # Reverse proxy, microcache, WS upgrade, CSP headers
βββ package.json # Scripts and locked frontend dependencies
βββ vite.config.js # Vite build chunking and Vitest configuration
βββ src/
βββ pages/ # Landing, Dashboard, Stats, Races, RaceDetail, LiveTiming,
β # OverlayLive, Compare, Simulator, GhostRace, Bingo, Guide,
β # Drivers, Teams, DriverProfile, TeamProfile, NotFound
βββ components/ # Layout, Telemetry charts, Race tables, SVG track maps
βββ data/ # Canonical circuit paths, corner lore, team colors/logos
βββ hooks/ # Live timing WebSocket and physics simulation hooks
βββ services/ # Typed API client with timeout & AbortSignal support
βββ utils/ # Championship math, next-race resolver, bingo & chart utils
From F1-Fullstack-project/, copy .env.example if needed and launch the stack:
cd F1-Fullstack-project
cp Backend/.env.example Backend/.env
docker compose up --build -d- Web App (via Nginx):
http://localhost:5173 - Health Check:
http://localhost:5173/health
Stop the stack with:
docker compose downLaunch Uvicorn from inside Backend/ so .env, logs/, and cache/ paths resolve relative to the backend directory:
cd F1-Fullstack-project/Backend
python -m venv venv
# Windows PowerShell:
.\venv\Scripts\Activate.ps1
# Linux / macOS:
source venv/bin/activate
pip install -r requirements.txt
cp .env.example .env
uvicorn main:app --host 127.0.0.1 --port 8000 --reload- API Base URL:
http://127.0.0.1:8000 - Swagger UI (development mode):
http://127.0.0.1:8000/docs
Requires Node.js >=20.19.0 (Node 22 LTS recommended):
cd F1-Fullstack-project/frontend
npm ci --ignore-scripts
cp .env.example .env
npm run dev- Frontend Dev Server:
http://localhost:5173
Run the exact checks enforced by .github/workflows/ci.yml before pushing:
cd F1-Fullstack-project/frontend
npm run typecheck # tsc --noEmit
npm run lint # ESLint (typescript-eslint + react-hooks)
npm run test # Vitest unit & component suite
npm run build # Production bundle buildcd F1-Fullstack-project/Backend
python -m compileall -q .
python -m ruff check .
python -m unittest discover -s tests -vNote: Passing ?refresh=true on cached read endpoints requires a valid X-API-Key header.
| Method | Endpoint | Description | Rate Limit |
|---|---|---|---|
GET |
/health |
Service and Redis cache health check | Exempt |
GET |
/api/dashboard/{year} |
Season overview, leader gap, recent results, next session | 100/minute |
GET |
/api/championship/{year} |
WDC & WCC standings plus per-round session_results |
100/minute |
GET |
/api/standings/{year} |
Standings endpoint (shares FastF1/OpenF1 pipeline; optional SQLite mode) | 100/minute |
GET |
/api/races/{year} |
Season calendar, round status, and race winners | 100/minute |
GET |
/api/race/{year}/{round} |
Full weekend classification, stints, sectors, weather, lap/gap charts | 60/minute |
GET |
/api/telemetry-drivers/{year}/{round} |
Drivers available for telemetry comparison in a round | 100/minute |
GET |
/api/telemetry/{year}/{round}?drivers=VER,NOR |
Distance-aligned telemetry channels for up to 5 drivers | 60/minute |
GET |
/api/driver/{year}/{driver_id} |
Driver season profile, H2H split, progression, DNF/DNS details | 100/minute |
GET |
/api/team/{year}/{team_id} |
Constructor season profile, driver points share, progression | 100/minute |
GET |
/api/team_radio?session_key=latest |
Team radio clips from OpenF1 with SignalR cache fallback | 60/minute |
GET |
/api/livetiming/previous |
Snapshot of the last completed live-timing session | 60/minute |
WS |
/ws/livetiming |
Real-time SignalR timing, track map, weather, and race control feed | Max 5 / IP |
POST / DELETE / GET |
/api/clear_cache/{year} |
Clears Redis and disk caches for {year} (requires X-API-Key) |
5/minute |
This project is released under the MIT License.
Disclaimer: This project is unofficial and is not associated in any way with the Formula 1 companies. F1, FORMULA ONE, FORMULA 1, FIA FORMULA ONE WORLD CHAMPIONSHIP, GRAND PRIX, and related marks are trademarks of Formula One Licensing B.V.