RaceCast is a comprehensive Formula 1 analytics dashboard that combines machine learning predictions with historical performance analysis. Built with modern web technologies, it provides real-time race predictions, driver performance insights, and strategic analysis for F1 enthusiasts and professionals.
- ML-Powered Predictions: Advanced XGBoost models trained on 3,318+ driver-race combinations
- Real-time Accuracy Tracking: Monitor prediction performance with top-3 and top-5 accuracy metrics
- Live Race Updates: Automatic updates during race weekends with smart caching strategies
- Driver Performance: Comprehensive analysis of individual driver capabilities across different conditions
- Constructor Performance: Team-based analytics with historical standings and trends
- Era & Regulation Analysis: Compare performance across different F1 regulation periods (2018-2021 vs 2022+)
- Driver Personality Profiles: AI-driven personality analysis and racing archetypes
- Winning Trends: Historical performance trends and strategic patterns for drivers and teams
- Era & Regulation Analysis: Compare performance across different F1 regulation periods
- Framework: Next.js 15.2.4 with React 19
- Styling: Tailwind CSS with custom design system
- UI Components: Radix UI primitives with custom styling
- State Management: Zustand for global state
- Data Fetching: TanStack Query (React Query) with smart caching
- Charts: Recharts for data visualization
- Icons: Lucide React
- Mobile Responsive: Optimized for mobile devices with hamburger menu navigation
- Database: Neon PostgreSQL (serverless)
- API Integration: Ergast F1 API for live data
- ML Backend: Python-based prediction API (deployed on Render)
- Data Sources: Enhanced F1 dataset (2018-2025) with FastF1 telemetry
- Runtime: Bun 1.1.30 (package manager)
- Deployment: Vercel with edge functions
- Cron Jobs: Automated prediction updates (Saturdays 7 PM) and result updates (Sundays 8 PM)
- Analytics: Vercel Analytics integration
The application leverages a comprehensive F1 dataset featuring:
- 3,318 driver-race combinations across 8 seasons (2018-2025)
- 110 total features combining Ergast API and FastF1 telemetry data
- 166 races with 43 unique drivers
- 71.3% FastF1 telemetry coverage for advanced performance metrics
- Real-time integration with official F1 data sources
- Bun 1.1.30 or later
- Node.js 18+ (if not using Bun)
- Neon PostgreSQL database
- API key for the prediction backend
-
Clone the repository
git clone <repository-url> cd racecast_frontend
-
Install dependencies
bun install
-
Environment Setup Create a
.env.localfile with the following variables:NEXT_PUBLIC_DATABASE_URL=your_neon_database_url API_KEY=your_prediction_api_key
-
Run the development server
bun dev
-
Open your browser Navigate to http://localhost:3000
The application is optimized for deployment on Vercel:
-
Deploy to Vercel
vercel --prod
-
Configure Environment Variables
- Set
NEXT_PUBLIC_DATABASE_URLin Vercel project settings - Set
API_KEYfor prediction backend access
- Set
-
Cron Jobs The application automatically configures cron jobs for:
- Race predictions (Saturdays at 7 PM)
- Result updates (Sundays at 8 PM)
racecast_frontend/
βββ app/ # Next.js app directory
β βββ api/ # Server-side API routes
β β βββ cron/ # Cron job endpoints
β β βββ race-prediction/ # Race predictions and results API
β β βββ driver-performance/ # Driver analytics API
β β βββ constructor-performance/ # Constructor analytics API
β β βββ driver-personality/ # Personality analysis API
β β βββ winning-trends/ # Historical trends API
β β βββ era-analysis/ # Era regulation API
β βββ layout.tsx # Root layout
β βββ page.tsx # Main dashboard
βββ components/ # React components
β βββ ui/ # Reusable UI components
β βββ race-prediction.tsx
β βββ driver-performance.tsx
β βββ constructor-performance.tsx
β βββ era-regulation.tsx
β βββ driver-personality.tsx
β βββ winning-trends.tsx
βββ lib/ # Utility libraries
β βββ neon-client.ts # Database client
β βββ race-store.ts # Zustand store
β βββ era-analysis.ts # Data analysis utilities
βββ docs/ # Documentation
β βββ api_documentation.md
β βββ data_sources.md
β βββ enhanced_dataset_documentation.md
βββ public/ # Static assets
The application implements intelligent caching based on race calendar:
- Race weekends: 3-minute cache with 15-minute refresh intervals
- Normal days: 30-minute cache
- Season end: 24-hour cache
- Live season (2025): 5-minute cache with focus refresh
- Historical data: 10-minute cache
- 2025 (live season): Ergast API for official standings and results
- 2018-2024: Enhanced dataset for comprehensive analytics
- Automatic fallback: Seamless switching between data sources
- Base URL:
https://racecast-backend.onrender.com - Authentication: API key required
- Endpoints:
GET /healthz- Health checkGET /last_race- Last race informationPOST /predict- Generate race predictions
- Base URL:
https://api.jolpi.ca/ergast/ - No authentication required
- Real-time F1 data: Results, standings, race information
The application uses server-side API routes to prevent SQL queries from being exposed in the browser:
/api/race-prediction- Race predictions, results, and race information/api/driver-performance- Driver performance analytics and standings/api/constructor-performance- Constructor performance and team analytics/api/driver-personality- Driver personality analysis and archetype data/api/winning-trends- Historical winning trends for drivers and constructors/api/era-analysis- Era and regulation analysis data/api/cron- Automated cron job endpoints for predictions and result updates
Security Benefits:
- SQL queries are never exposed to the client-side
- Database connection strings remain server-side only
- Enhanced data protection and query optimization
- Better performance through server-side query execution
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
This project is licensed under the GNU General Public License v3.0. (GPL-3.0)
Important: GPL v3 requires that any derivative works must also be open source and licensed under GPL v3 or compatible license.
- Ergast API for comprehensive F1 historical data
- FastF1 for advanced telemetry and session data
- Formula 1 for the incredible sport and data
- Vercel for seamless deployment and hosting
- Neon for serverless PostgreSQL database
Built with β€οΈ for F1 fans and data enthusiasts
Version: 0.1.0 β’ Updated 2025
