Backend service for parsing game replays and providing aggregated statistical analytics through an API.
The system extracts structured data from replay files, stores it in a relational database, and exposes analytical endpoints for further consumption by external services or frontend applications.
-
Replay parsing
- Extraction of match, player, bonus, and timing data
- Validation and normalization of replay contents
- Support for background and scheduled parsing jobs
-
Statistics storage
- Normalized relational data model
- Optimized queries for analytical workloads
-
Analytics API
- Win rate calculations
- Match duration statistics (average, median, percentiles)
- Bonus-based and mode-based aggregations
- Flexible filtering by date ranges and parameters
-
Background processing
- Scheduled replay ingestion
- Periodic recalculation of aggregates
- Node.js
- NestJS
- Prisma
- PostgreSQL
- Docker / Docker Compose
- Kysely (for analytical SQL queries, if applicable)
- Cron jobs for scheduled tasks
External data provider(s) → Replay files → Parser → Database → Analytics Service → API
- The parser is responsible only for replay decoding and validation
- The backend service handles persistence and analytics
- Business logic is intentionally kept out of the frontend
- Node.js >= 18
- Docker
- PostgreSQL (local or containerized)
git clone https://github.com/BogdanTretyakov/sc-statistic-backend.git
cd sc-statistic-backend
yarn install
cp .env.example .env
docker-compose -f docker-compose.dev.yml up -dyarn prisma migrate devyarn start:devService used wikidata.service for getting data about game id's. Check out typing for yours implements or just use my public repo for getting game data
There is admin panel at localhost:4000/admin. For replay parsing and analytics working you MUST specify wiki data key for every unique map version
Data from external providers coming in 3 steps:
fetcher.serviceget lists of matches and store match meta and replay urlmapper.servicedownloads replay binary filereplay.serviceparsing downloaded replays, writing parsed data and cleans up garbage
All tasks doing asynchronously by cron jobs. For adding new providers just implement needed external provider at first two services
Check out analytic.controller. There is no OpenAPI or some same API Schemas.
WTFPL