An AI-powered Formula 1 race result predictor with a beautiful, user-friendly interface. Perfect for both F1 enthusiasts and newcomers to the sport.
- 🤖 AI-Powered Predictions: Get instant race predictions using machine learning
- 🎨 Beautiful UI: Modern, intuitive interface that's easy to use
- 🚀 Fast Performance: Built with Next.js for optimal speed
- 📱 Responsive Design: Works perfectly on desktop and mobile devices
- 🌙 Dark Mode: Automatic dark mode support
- 🗺️ Interactive Map: Select races visually on a world map
- 🎯 Custom Scenarios: Create your own race scenarios for predictions
This project consists of two separate, independently deployable applications:
- Frontend: Next.js application (deployed to Vercel)
- Backend: FastAPI application (deployed to Railway/Render)
They communicate via REST API calls. See DEPLOYMENT.md for deployment instructions.
f1-pulse/
├── app/ # Next.js frontend application
│ ├── page.tsx # Main prediction interface
│ ├── components/ # React components
│ ├── utils/ # Utility functions
│ └── ...
├── backend/ # FastAPI backend (standalone)
│ ├── main.py # FastAPI application
│ ├── F1_predict_md.py # ML model integration
│ ├── requirements.txt # Python dependencies
│ ├── Procfile # Deployment config
│ ├── railway.json # Railway config
│ ├── render.yaml # Render config
│ └── README.md # Backend documentation
├── public/ # Static assets
├── DEPLOYMENT.md # Deployment guide
└── README.md # This file
- For Frontend: Node.js 18+ and npm
- For Backend: Python 3.11+ and pip
-
Install dependencies:
npm install
-
Set environment variable (create
.env.local):NEXT_PUBLIC_API_URL=http://localhost:8000
-
Run the development server:
npm run dev
-
Open http://localhost:3000 in your browser
See backend/README.md for detailed setup instructions.
Quick start:
cd backend
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -r requirements.txt
uvicorn main:app --reload --host 0.0.0.0 --port 8000The API will be available at http://localhost:8000
-
Start both servers:
- Frontend:
npm run dev(runs on port 3000) - Backend:
uvicorn main:app --reload(runs on port 8000)
- Frontend:
-
Open the app in your browser at
http://localhost:3000 -
Select a race from the map or dropdown, or create a custom scenario
-
Click "Generate Prediction" to see AI-powered race predictions!
GET /- Health checkGET /health- Health checkPOST /predict- Get race predictions- Request:
{ "race_name": "Monaco Grand Prix", "circuit_name": "...", "race_date": "..." } - Response:
{ "predicted_winner": "...", "top_3": [...], "confidence": 0.85, ... }
- Request:
When the backend is running, visit:
- Swagger UI:
http://localhost:8000/docs - ReDoc:
http://localhost:8000/redoc
Create .env.local in the root directory:
NEXT_PUBLIC_API_URL=http://localhost:8000For production, set this in your deployment platform (e.g., Vercel).
Set ALLOWED_ORIGINS to allow frontend requests:
export ALLOWED_ORIGINS="http://localhost:3000,https://your-app.vercel.app"For production, set this in your deployment platform (e.g., Railway/Render).
- Frontend: Next.js 16, React 19, TypeScript, Tailwind CSS, Leaflet
- Backend: FastAPI, Python 3.11+, CatBoost, FastF1, Pandas
- Deployment:
- Frontend: Vercel (or any Next.js hosting)
- Backend: Railway, Render, or any Python hosting platform
npm run dev # Start dev server
npm run build # Build for production
npm run start # Start production server
npm run lint # Run lintercd backend
uvicorn main:app --reload --host 0.0.0.0 --port 8000See backend/README.md for more details.
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
MIT License - feel free to use this project for your own purposes!
For detailed deployment instructions, see DEPLOYMENT.md.
Quick summary:
- Deploy backend to Railway/Render (set
ALLOWED_ORIGINS) - Deploy frontend to Vercel (set
NEXT_PUBLIC_API_URL) - Both services communicate via HTTP API
For issues or questions:
- Backend: See backend/README.md
- Deployment: See DEPLOYMENT.md
- API docs:
http://localhost:8000/docs(when backend is running)
Built with ❤️ for F1 fans and AI enthusiasts