The backend is a FastAPI service providing a REST API for managing players, teams, matches, and stats for the Bodega Esports Platform. It includes endpoints for leaderboards, standings, and integrates with Discord for authentication.
- Python 3.10+
- FastAPI (web framework)
- Uvicorn (ASGI server)
- SQLAlchemy (ORM, Postgres backend)
- Docker (optional for local dev)
- Railway (cloud deployment)
- Core API endpoints:
/api/leaderboard
/api/standings
/api/teams
/api/matches
- Stat normalization & MVP scoring
- CSV/Google Sheets export hooks
- Discord OAuth compatibility
bodega-backend/
├── app/
│ ├── api/
│ ├── analytics_models/
│ ├── config.py
│ ├── database.py
│ ├── main.py
│ ├── models/
│ ├── routers/
│ ├── schemas/
│ ├── utils/
├── alembic/
├── docs/
├── migrations/
├── scripts/
├── tests/
├── requirements.txt
├── start.sh
- Clone the repo:
git clone https://github.com/wersplat/bodega-esports-platform.git
- Enter backend:
cd bodega-esports-platform/backend
- Create virtualenv & activate:
python -m venv venv && venv\Scripts\activate
(Windows) orsource venv/bin/activate
(Linux/Mac) - Install dependencies:
pip install -r requirements.txt
- Copy and edit environment variables:
copy .env.template .env
(Windows) orcp .env.template .env
(Linux/Mac) - Run server:
uvicorn app.main:app --reload
Key environment variables:
DATABASE_URL
— Postgres connection stringDISCORD_OAUTH_CLIENT_ID
/DISCORD_OAUTH_CLIENT_SECRET
— Discord OAuth credentialsSECRET_KEY
— FastAPI secret
- Railway auto-detects
bodega-backend/
as a web service. - Build command:
pip install -r requirements.txt
- Start command:
uvicorn app.main:app --host 0.0.0.0 --port 10000
- Health check:
/healthz
- Or use:
./start.sh
- Run tests with:
pytest
- OpenAPI docs: http://localhost:8000/docs
- ReDoc: http://localhost:8000/redoc
- Run local docs server:
mkdocs serve
- Main backend docs: see
docs/Backend-README.md
- Issues and PRs welcome!
- Follow PEP8 and repo coding style.
- GPLv3 License
- © Bodega Cats Gaming Club