2026 · Author
Alekhine's Counter-Gambit
A distributed chess platform: play Stockfish or a friend live, with moves validated, streamed, analysed and observed on Kubernetes.
Problem
why this existsPlaying chess online looks simple; the platform behind it is a full tour of distributed systems — authoritative rules on the server, live move streaming, compute-heavy analysis that never blocks play, clocks, ratings that update exactly once.
Architecture
napkin sketch, cleaned up- Web clientWebSockets
- GatewayGraphQL
- Game serviceGo + Erlang
- Engine workersStockfish
- Kafkapost-game analysis
Independently scalable services over gRPC and a Kafka event bus, with durable storage, live WebSocket fan-out, full metrics and traces, and a GitOps pipeline onto Kubernetes.
Technical decisions
and the trade-offsNever trust the client
Rules are enforced authoritatively on the server.
Asynchronous analysis
Finished games are analysed by a Kafka-fed worker pool so engine work never blocks play.
Screenshots
taped inKey engineering challenges
the bruises- 1
Clocks and ratings
Clocks must never flag-fall a decided game, and ratings must update exactly once.
- 2
Observability
A single move request is traced across gateway → game-service → engine-worker in Jaeger.
Results
- ✔ Six services over gRPC and Kafka: gateway, game, session (Erlang/OTP), engine worker, analysis worker, spectator fan-out
- ✔ Move generation verified by perft: 197,281 nodes to depth 4 from the start position
- ✔ 17.6k lines, 118 tests and five architecture decision records
- ✔ Runs on Kubernetes, reconciled from the repo by Argo CD
Learnings
- ✎ One supervised Erlang process per game means killing a game never touches another.
- ✎ Verify the move generator with perft before trusting anything built on top of it.



