Software

NebulaRealtime

A server-authoritative multiplayer backend with matchmaking, WebSocket sessions and shared state coordination.

Role
Solo developer
Status
Public source
Technology
Node.js + TypeScript
Platform
server · distributed
Team size
1 person
Year
2026

Tools Node.js · TypeScript · Fastify · WebSocket · Redis · PostgreSQL · BullMQ · Docker · Prometheus

Topics WebSockets · Redis · PostgreSQL · Real-Time · Distributed

NebulaRealtimeSystem diagram
  1. Player input
  2. Validate on tick
  3. Match history
Redis coordination
WebSocket inputServer authorityPostgreSQL
Simplified match flow. Redis coordinates matchmaking and messaging. Background workers persist match history.

One authority for match state

Clients send inputs over WebSockets. The simulation validates them and applies the updates on a fixed tick, so the server controls the resulting game state.

Coordination across instances

I used Redis for shared matchmaking and cross-server messages, BullMQ for background work, and PostgreSQL to persist match data. The repository includes a two-instance Docker Compose setup.

What the tests measured

I benchmarked individual endpoints and WebSocket behavior in a local Docker Compose setup. The health check was a lightweight HTTP workload. The raw files show slower authenticated endpoints and include errors and timeouts for those workloads.

Results from a local test

WorkloadMeasured result
HTTP health check48,365 requests/s on one instance
WebSocket connection batch30 of 30 stayed connected
WebSocket ping/pong1.29 ms average, 13.91 ms p99

Local Docker Compose. The HTTP run used 100 connections over about 15 seconds. The ping test recorded 50 rounds. Benchmark scripts and raw results.

Development notes

Production-grade real-time multiplayer backend with horizontally scalable WebSocket servers, Redis coordination, matchmaking, and authoritative simulation. Load-tested to ~96K req/s across instances.

Built and scaled a real-time multiplayer infrastructure with WebSocket horizontal scaling, server-authoritative simulation, and comprehensive observability

The figures below are from the original project notes. See the local test table above for the workloads and results supported by the published raw files.

My responsibilities
  • Designed and implemented full WebSocket scaling architecture
  • Built matchmaking, presence, and leaderboard systems
  • Integrated PostgreSQL persistence with BullMQ workers
  • Load-tested and hardened for production deployment
Design & engineering concepts
  • Horizontally scalable WebSocket architecture with Redis Pub/Sub coordination
  • Server-authoritative game simulation preventing client-side cheating
  • Distributed matchmaking with presence tracking across instances
  • Production observability with Prometheus metrics and structured logging
Mechanics & implementation
  • ~48K req/s single instance, ~96K req/s multi-instance proven capacity
  • ~1.29ms average WebSocket RTT, ~1.98ms handshake latency
  • 5K concurrent connection load profile with stable performance
  • Distributed locks for race condition prevention
Lessons learned
  • Real-time systems require careful state synchronization and conflict resolution
  • Load testing early reveals scalability bottlenecks before production
  • Observability is not optional for distributed systems
Problem

Real-time multiplayer systems must handle persistent connections, matchmaking, presence, state synchronization, concurrent actions, and scaling across multiple server instances.

System design
  • WebSocket multiplayer infrastructure
  • Horizontal WebSocket scaling
  • Redis Pub/Sub
  • Matchmaking and presence
  • Server-authoritative simulation
  • Leaderboards
  • PostgreSQL persistence
  • BullMQ workers
  • JWT authentication
  • Prometheus metrics
  • Structured logging
  • Rate limiting
  • Distributed locks