Solution Featured

Multiplayer game events and live leaderboard

Stream player and match events through Redpanda, fan them out to a live leaderboard, an achievements service and a Postgres match history, and replay them on demand.

Time
45 min
Steps
4
Runs on
Docker Compose Redpanda Cloud
Technologies
Go Protobuf Schema Registry Redpanda Connect Redis Postgres
Version
v1.0.0
Last verified
September 13, 2026 against Redpanda 26.2.2

A game studio needs one event stream that feeds a live leaderboard, awards achievements, and keeps a queryable match history, without the services knowing about each other. This solution builds that system on Redpanda: a simulator produces Protobuf game events, three independent consumers read the same topics, and Redpanda Connect lands match history in Postgres with no code.

Architecture

Architecture

Every service reads the same game.player-events and game.match-events topics through its own consumer group, so adding the achievements service later did not touch the leaderboard. Keys are player_id and match_id, which gives per-player and per-match ordering for free.

In production

Run at least three brokers with replication factor 3, turn on TLS and SASL, and size partitions for the peak burst rather than the average rate. Tiered Storage keeps the full event history replayable without growing local disks.

Prerequisites

  • Docker Desktop 4.30 or later with 8 GB of memory available

  • rpk 24.3 or later

  • Go 1.22 or later if you want to change the services

The environment file every service reads:

.env.example
REDPANDA_BROKERS=localhost:9092
SCHEMA_REGISTRY_URL=http://localhost:8081
REDIS_ADDR=localhost:6379
POSTGRES_DSN=postgres://solutions:solutions@localhost:5432/matches

Production considerations

Concern What this solution does What to change for production

Brokers

One broker, replication factor 1

Three brokers, replication factor 3

Security

No TLS, no authentication

TLS, SASL/SCRAM, ACLs per service

Consumer scaling

One instance per service

Scale on consumer lag

Clean up

docker compose down -v