Personalised, on-demand champion-pool coaching for League of Legends players. RiftCoach ingests your recent matches, compares your stats to curated Challenger/Grandmaster datasets, and returns actionable steps in seconds.
- Async FastAPI backend with Celery workers keeps the API responsive while heavy analyses run in the background.
- Champion taxonomy + embedding engine produce meaningful pool cohesion scores and role-aware swap suggestions.
- Daily pro index refresh keeps comparisons grounded in up-to-date high-Elo data.
- Next.js 14 frontend provides a polished entry point for players to submit Riot IDs and track job status.
- Backend –
apps/backend, FastAPI (app/main.py) with/coach/analyze+/coach/analyze/{job_id}. Celery (app/celery_app.py) executes analysis (tasks/analyze.py) and scheduled pro index refreshes (tasks/pro_index.py). Riot API access is handled by a sharedRiotClient(app/utils/riot.py). - Frontend –
apps/frontend, Next.js 14 + Tailwind + shadcn/ui. The UI submits jobs to the backend and explains how RiftCoach works. - Data – Cached Riot payloads live under
data/raw/<puuid>/; Challenger/Grandmaster projections sit indata/pros/<region>/index.jsonl. These directories are git-ignored so large caches stay local. - Infra – AWS CDK scaffolding (
infra/) prepared for future deployment automation. Production Dockerfiles target EC2 hosts (backend + worker) and static hosting for the frontend.
Prerequisites: Docker Desktop (or Docker Engine), a Riot API key, and make (optional convenience).
- Duplicate
.env.localand fill in the blanks:Docker Compose readscopy .env.local .env.local.dev # edit .env.local.dev and replace RIOT_API_KEY with your key.env.localby default, so either edit the file in place or pointenv_fileto your copy. - Start the stack:
make up # or without make: docker compose up --build - Visit http://localhost:3000 to access the frontend. The backend listens on http://localhost:8000 and exposes a
/docsSwagger UI. - When finished, shut everything down with
make downordocker compose down.
- PowerShell:
.\scripts\riftrewind.ps1 up | down | logs | build-prod - Command Prompt:
scripts\riftrewind.cmd up | down | logs | build-prod
cd apps/backend
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
uvicorn app.main:app --reload
celery -A app.celery_app.celery_app worker --loglevel=infoSet the same environment variables as in .env.local (at minimum RIOT_API_KEY, CELERY_BROKER_URL, CELERY_RESULT_BACKEND).
cd apps/frontend
npm install
echo "NEXT_PUBLIC_API_URL=http://localhost:8000" > .env.local
npm run dev # http://localhost:3000POST /coach/analyzeResponse:curl -s http://localhost:8000/coach/analyze \ -H "Content-Type: application/json" \ -d '{"game_name":"Sneaky","tag_line":"NA1","region":"americas","queue":420,"limit":50}'
{ "job_id": "e3c3a6f1-...", "status": "ok" }GET /coach/analyze/{job_id}Returnscurl -s http://localhost:8000/coach/analyze/e3c3a6f1-...
"running"until complete, then a fullAnalyzeResponsecontaining:- top 5 champions with stats, winrate, and taxonomy metadata,
- a recommended swap (drop/add champion ids + similarity),
- the closest Challenger/Grandmaster “pro twin”,
- the biggest statistical delta to focus on,
- session-by-session winrate progression.
If Riot’s API throttles or the job fails, the status endpoint surfaces a friendly error message.
- Match caches are stored on disk at
data/raw/<puuid>/. Each directory contains per-match JSON files, amanifest.jsonindex, and a compatibilitymatches.json. - The pro index is refreshed daily by Celery Beat. To run it manually:
This command requires a Riot API key and writes to
python -m apps.backend.app.services.pro_index_builder update-region \ --region europe --platform EUW1 --queue 420 --limit 50
data/pros/europe/index.jsonl. - Sample payloads under
sample_data/unblock development without live API access.
python -m pytesttests/test_ingest_local.pycovers caching, Riot ID resolution, and year-based ingestion.
| Variable | Description | Default |
|---|---|---|
RIOT_API_KEY |
Required to call Riot’s Match-V5 and account APIs. | none |
CELERY_BROKER_URL |
Celery broker (Redis by default in Docker Compose). | redis://redis:6379/0 |
CELERY_RESULT_BACKEND |
Celery result backend. | Same as broker |
DEFAULT_REGION |
Fallback Riot regional shard. | europe |
DEFAULT_QUEUE |
Ranked queue id. | 420 |
USER_RECENT_MATCHES |
Default number of matches to analyse. | 50 |
API_ALLOWED_ORIGINS |
Comma-separated CORS allowlist for the API. | * |
NEXT_PUBLIC_API_URL |
Frontend environment variable pointing to the API base URL. | http://localhost:8000 |
See apps/backend/app/core/config.py for additional toggles (ROLE_HARD_FILTER, embedding weights, cache TTL).
├── apps
│ ├── backend # FastAPI app, Celery tasks, services, data helpers
│ └── frontend # Next.js UI
├── data # Local caches (git-ignored)
├── docs # Architecture, run-books, onboarding material
├── infra # CDK placeholders
├── scripts # Cross-platform tooling and utilities
├── tests # Pytest suite
└── docker-compose.yml # Local stack orchestration
MIT – see LICENSE.
Questions or ideas? Open an issue or reach out via the project discussions. Contributions are welcome!