Skip to content

wersplat/bodega-backend

Repository files navigation

Bodega Esports Platform — Backend

Python Railway CI License

Overview

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.

Tech Stack

  • Python 3.10+
  • FastAPI (web framework)
  • Uvicorn (ASGI server)
  • SQLAlchemy (ORM, Postgres backend)
  • Docker (optional for local dev)
  • Railway (cloud deployment)

Features

  • Core API endpoints:
    • /api/leaderboard
    • /api/standings
    • /api/teams
    • /api/matches
  • Stat normalization & MVP scoring
  • CSV/Google Sheets export hooks
  • Discord OAuth compatibility

Folder Structure

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

Quick Start

  1. Clone the repo:
    git clone https://github.com/wersplat/bodega-esports-platform.git
  2. Enter backend:
    cd bodega-esports-platform/backend
  3. Create virtualenv & activate:
    python -m venv venv && venv\Scripts\activate (Windows) or source venv/bin/activate (Linux/Mac)
  4. Install dependencies:
    pip install -r requirements.txt
  5. Copy and edit environment variables:
    copy .env.template .env (Windows) or cp .env.template .env (Linux/Mac)
  6. Run server:
    uvicorn app.main:app --reload

Configuration

Key environment variables:

  • DATABASE_URL — Postgres connection string
  • DISCORD_OAUTH_CLIENT_ID / DISCORD_OAUTH_CLIENT_SECRET — Discord OAuth credentials
  • SECRET_KEY — FastAPI secret

Deployment

  • 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

Testing

  • Run tests with:
    pytest

API Documentation

Docs

  • Run local docs server:
    mkdocs serve
  • Main backend docs: see docs/Backend-README.md

Contributing

  • Issues and PRs welcome!
  • Follow PEP8 and repo coding style.

License & Author

About

bodega-backend module of esports-platform

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages