Full stack web application for UFC matchup analysis. The project compares two fighters, shows side-by-side stats, and returns a machine learning prediction with confidence and explanatory factors.
The application is split into a React frontend and a FastAPI backend. The backend loads a trained scikit-learn model and fighter data, while the frontend provides the user interface for selecting fighters and viewing prediction results.
Frontend
- React
- TypeScript
- Vite
- Tailwind CSS
- Axios
- React Router
Backend
- FastAPI
- Uvicorn
- Pydantic
Machine Learning
- Python
- Pandas
- NumPy
- scikit-learn
- Joblib
- SHAP
- Fighter search and selection
- Red corner vs blue corner comparison
- Prediction result with confidence score
- Fighter profile and matchup statistics
- Model information endpoint
- Responsive frontend deployed on Vercel
- FastAPI backend deployed on Render
.
├── backend/ # FastAPI application
│ ├── app/
│ │ ├── main.py # API entry point
│ │ ├── routers/
│ │ ├── schemas/
│ │ └── services/
│ ├── model/ # Trained model artifact
│ └── requirements.txt
├── frontend/ # React + Vite frontend
│ ├── src/
│ ├── package.json
│ └── vercel.json
├── data/ # Raw and processed data
├── scripts/ # Data pipeline scripts
├── src/ufc_predictor/ # ML feature engineering code
├── render.yaml # Render deployment config
└── runtime.txt # Python runtime for Render
GET /- API informationGET /health- service health checkGET /fighters- fighter catalogPOST /predict- matchup predictionGET /model-info- model metrics and features
pip install -r backend/requirements.txt
uvicorn backend.app.main:app --reloadAPI docs:
http://127.0.0.1:8000/docs
cd frontend
npm install
npm run devFrontend:
http://127.0.0.1:5173
For local frontend API calls, create frontend/.env:
VITE_API_URL=http://127.0.0.1:8000The backend is configured through render.yaml.
Start command:
uvicorn backend.app.main:app --host 0.0.0.0 --port $PORTHealth check:
/health
Use these settings:
- Root directory:
frontend - Framework preset:
Vite - Build command:
npm run build - Output directory:
dist
The frontend uses frontend/vercel.json to proxy /api/* requests to the Render backend and to support client-side routing.
The current model uses matchup-based features such as age difference, height difference, reach difference, win rate, stance, striking accuracy, and takedown accuracy. Predictions are intended for educational and portfolio purposes only.
This project is not betting advice. Predictions are estimates based on historical data and model assumptions.