Skip to content
This repository was archived by the owner on Dec 20, 2025. It is now read-only.

furioness/reflex-arena-stats-service

Repository files navigation

Reflex Arena Stats Service

⚠️ Project Status: Archived
This project has been discontinued as the official Reflex Arena developers have implemented their own matchmaking system and stats infrastructure.

Many things are in a sketch-like state, specifically no proper deployment configuration and bare-bone front-end.

This readme is composed mainly using AI - better than nothing.

🎯 Overview

A full-stack web service designed to collect, analyze, and display detailed player statistics and match history for Reflex Arena using a patched reflexded.exe server. Originally envisioned as a comprehensive stats and matchmaking platform, this project demonstrates practical implementation of modern web development patterns, real-time data ingestion, and sports analytics concepts.

**Original inspiration and reflexded patch: ** reflex-arena.ru by Sesen

🏗️ What's Implemented

Backend (FastAPI + SQLAlchemy)

  • Layered Architecture: Clean separation between controllers, services, repositories, and entities, though it's mostly just CRUD
  • Match Data Ingestion: RESTful endpoint (/reflexded/*) to receive and store match results from patched dedicated servers
  • Player Statistics API: Query endpoints for player profiles, match history, and weapon statistics
  • Match History API: Retrieve detailed match information including map, mode, duration, and player performance
  • Database Management: PostgreSQL with Alembic migrations for schema versioning
  • Type Safety: Comprehensive DTOs for API contracts and internal data flow

Frontend (Vue 3 + TypeScript)

  • Modern Vue 3 Stack: Composition API, bits of TypeScript, Vue Router
  • Player Profiles: Display basic player information and recent match history
  • Match Browser: View recent matches with key statistics
  • Chart.js Integration: Foundation for advanced weapon stats visualization (radar charts, progression lines)

Infrastructure & DevOps

  • Dockerized Environment: Full Docker Compose setup for local development and production deployment
  • CI Pipeline: GitHub Actions workflow with:
    • Automated testing (pytest with coverage)
    • Linting (Ruff with extensive rule set)
    • Self-hosted runner configuration
  • Database Optimization: Performance-tuned PostgreSQL config for CI/CD environments
  • Testing Suite: Pytest with async support (though could just use a sync DB driver), fixtures, and mocking utilities

Quality Assurance

  • Comprehensive Test Coverage: Unit and integration tests for core business logic
  • Code Quality Tools:
    • Ruff for Python linting (50+ enabled rules)
  • Development Standards: EditorConfig, strict type checking

🚀 Running Locally

Prerequisites

  • Python 3.13+ with uv package manager
  • Docker and Docker Compose
  • Node.js 22+ with Bun runtime (for frontend)

Backend Setup

  1. Start the database:

    docker-compose -f docker-compose-dev.yml up -d
  2. Configure environment:

    cp .env.template .env
    # Edit .env with your database credentials
  3. Install dependencies and run migrations:

    uv sync
    uv run alembic upgrade head
  4. Start the development server:

    uv run fastapi dev

    API will be available at http://localhost:8000

Frontend Setup

  1. Navigate to frontend directory:

    cd frontend
  2. Install dependencies:

    bun install
  3. Start development server:

    bun run dev

    Frontend will be available at http://localhost:5173

Running Tests

# Backend tests
uv run pytest

# Backend linting
uv run ruff check app/

# Frontend tests
cd frontend
bun run test:unit

# E2E tests
bun run test:e2e

📐 Architecture Overview

Backend Structure

app/
├── controller/      # FastAPI route handlers (reflexded, match, player endpoints)
├── service/         # Business logic layer
├── repository/      # Database access layer
├── entity/          # SQLAlchemy models
├── dto/             # Data Transfer Objects (Pydantic models)
├── config/          # Database config and Alembic migrations
└── utils/           # Mock data generators, helpers

Data Flow: HTTP Request → Controller → Service → Repository → Database

Key Design Patterns

  • Repository Pattern: Abstraction over data access
  • Service Layer: Encapsulation of business logic
  • DTO Pattern: Type-safe API contracts with Pydantic
  • Dependency Injection: FastAPI's dependency system for DB sessions

Frontend Structure (Experimental)

  • Views: Page-level components (PlayerProfile, MatchList)
  • Components: Reusable UI elements
  • Stores: Pinia stores for state management (didn't get to the point of needing it)
  • Services: API client layer with TypeScript types
  • Router: Vue Router for navigation

CI/CD Pipeline

  • Trigger: Push to main branch or manual dispatch
  • Environment: Self-hosted runner with custom Docker image
  • Services: PostgreSQL 18 with health checks
  • Steps: Checkout → Install deps (uv) → Lint (Ruff) → Test (pytest)

🛠️ Tech Stack

Backend

  • Framework: FastAPI 0.118+ (async, type hints, OpenAPI)
  • ORM: SQLAlchemy 2 + Advanced Alchemy
  • Database: PostgreSQL 18 with asyncpg driver
  • Migrations: Alembic
  • Testing: pytest + pytest-asyncio + pytest-cov
  • Linting: Ruff (replaces Black, isort, flake8, etc.)
  • Package Manager: uv (fast, Rust-based Poetry alternative)

Frontend

  • Framework: Vue 3.5 (Composition API)
  • Language: TypeScript 5.9
  • State: Pinia 3.0
  • Router: Vue Router 4.6
  • Charts: Chart.js 4.5
  • Build Tool: Vite 7.1
  • Testing: Vitest + Playwright (didn't get there)
  • Package Manager: Bun

Infrastructure

  • Containerization: Docker + Docker Compose
  • CI: GitHub Actions (self-hosted runner)
  • Reverse Proxy: (Planned: Nginx for production)

💡 Original Vision (Unrealized)

The ideas/ folder contains detailed specifications for features that were planned but not implemented:

  • Advanced Stats Visualization: Radar charts for weapon proficiency, progression lines, GitHub-style activity calendars, geographic player distribution heatmaps
  • ELO Rating System: Full ranking implementation with historical recalculation
  • Matchmaking System: Lua-based client integration, queue management, server pool coordination, anti-DDoS via VPN tunneling
  • Replay System: Storage, parsing ( via reflex-replay-tools), heatmap generation (death spots, damage exchange, movement patterns)

See for the complete roadmap. ideas/agenda.md

📝 License

This project is provided as-is for portfolio and educational purposes.

🙏 Acknowledgments

  • Original concept and reflexded patch by Sesen (reflex-arena.ru)
  • Donaldduck8 for reflex-replay-tools
  • Reflex Arena devs for finally getting back to work!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors