A real-time multiplayer chess platform built on polyglot persistence. Every store was chosen against a specific access pattern rather than a default, and WebSockets keep two boards in sync without either player waiting on a database.
A chess game looks like a single application, but the data underneath behaves in three incompatible ways. Live game state is read and written on every move and worthless the moment the game ends. Match logs are written constantly and almost never updated. Accounts, ratings and friendships are relational and need real constraints.
Putting all three in one relational database is the default answer, and it fails predictably: the hot path for live moves contends with the append-heavy write path for logs, and both sit behind constraints that only the account data needs.
Matchmaking at scale: rating buckets, queue fairness, and what happens when the pool is thin. Then spectator mode, which is mostly a fan-out question the gateway already half answers.
Read the code on GitHub ↗