A dynamic League of Legends application that analyzes player match history and champion mastery to provide intelligent counter-pick recommendations using the official Riot Games API.
- Real-time Data Analysis: Fetches live player data from Riot Games API
- Champion Mastery Integration: Analyzes your top 15 most played champions
- Match History Analysis: Reviews your last 20 games for performance metrics
- Intelligent Scoring: Combines global win rates, personal mastery, and recent performance
- Dynamic Recommendations: Shows which champions from YOUR pool counter the enemy pick
- Multi-Region Support: Works with all major League of Legends regions
- Python 3.8+
- Node.js 16+
- Riot Games API Key (Get one here)
- Clone the repository
cd c:\Users\steam\OneDrive\Masaรผstรผ\riotapi- Backend Setup
cd backend
pip install -r requirements.txt- Configure API Key
Edit backend/.env:
RIOT_API_KEY=RGAPI-your-api-key-here
RATE_LIMIT_PER_SECOND=20
RATE_LIMIT_PER_TWO_MINUTES=100- Start Backend
python main.pyBackend runs at: http://localhost:8000
- Frontend Setup
cd ../frontend
npm install
npm run devFrontend runs at: http://localhost:5173
- Open
http://localhost:5173in your browser - Enter your Riot ID (e.g.,
Faker#T1) - Select your region
- Enter the enemy champion name (e.g.,
Darius) - Click "Find Counter-Picks"
The app will show you:
- Best counter-picks from your champion pool
- Suitability Score (0-100)
- Global Win Rate against the target
- Your Mastery Points on each champion
- Recent Performance (win rate from last 20 games)
main.py- API endpoints and request handlingriot_client.py- Riot Games API integrationscoring.py- Intelligent scoring algorithmmodels.py- Pydantic data models
- Modern React 18 with hooks
- Tailwind CSS for styling
- Axios for API calls
- Framer Motion for animations
The recommendation score is calculated using three weighted factors:
- Global Win Rate (45%): How well the champion performs against the target globally
- Mastery Points (35%): Your experience with the champion (logarithmic scale)
- Recent Performance (20%): Your win rate with the champion in recent games
Formula:
Score = (Global_WR ร 0.45) + (Mastery_Score ร 0.35) + (Recent_WR ร 0.20)
Health check endpoint
Response:
{
"message": "LPC-Engine Backend [Real Riot API] is Running",
"status": "ready"
}Get counter-pick recommendations
Request:
{
"summoner_name": "Faker",
"tag_line": "T1",
"region": "kr",
"target_champion": "Zed"
}Response:
{
"target_champion": "Zed",
"recommendations": [
{
"champion_id": "Malphite",
"champion_name": "Malphite",
"score": 78.5,
"details": {
"global_wr": 0.56,
"mastery": 250000,
"recent_wr": 0.65
}
}
]
}- TR - Turkey (
tr1) - EUW - West Europe (
euw1) - EUNE - Nordic & East (
eun1) - NA - North America (
na1) - BR - Brazil (
br1) - LAN - Latin America North (
la1) - LAS - Latin America South (
la2) - KR - Korea (
kr) - JP - Japan (
jp1)
"RIOT_API_KEY not found"
- Check your
.envfile has the correct API key
"ModuleNotFoundError"
- Run
pip install -r requirements.txt
"Cannot find module 'react'"
- Run
npm install
"Port already in use"
- Use a different port:
npm run dev -- --port 3000
"Account not found"
- Verify Riot ID format:
Name#TAG - Check you selected the correct region
"Rate limited"
- Development API keys have limits (20/sec, 100/2min)
- Wait a few moments or apply for a production key
riotapi/
โโโ backend/
โ โโโ main.py # FastAPI application
โ โโโ riot_client.py # Riot API client
โ โโโ scoring.py # Scoring engine
โ โโโ models.py # Data models
โ โโโ requirements.txt # Python dependencies
โ โโโ .env # API configuration
โ
โโโ frontend/
โ โโโ src/
โ โ โโโ App.jsx # Main React component
โ โ โโโ main.jsx # React entry point
โ โ โโโ index.css # Tailwind styles
โ โโโ index.html # HTML template
โ โโโ package.json # Node dependencies
โ โโโ tailwind.config.js # Tailwind config
โ โโโ vite.config.js # Vite config
โ
โโโ README.md # This file
โโโ KURULUM.md # Turkish setup guide
- Never commit
.envfiles to version control - Add
.envto.gitignore - Use environment variables in production
- Rotate API keys regularly
- Integration with U.GG/OP.GG for real-time counter data
- Redis caching for API responses
- User authentication and preferences
- Multi-role analysis (Top, Jungle, Mid, ADC, Support)
- Rank-based recommendations
- Team composition analysis
- Meta trend tracking
This project is for educational purposes. Riot Games API usage must comply with their Terms of Service.
Happy counter-picking! May your LP gains be plentiful! ๐