01 — The Problem
Correct on one process is not correct
A participant count kept in memory is right until there are two servers, and then it is two different numbers. Leaderboards have the same shape of problem: everybody in the room has to be looking at the same figure.
- Live counts and leaderboards shared across every connection.
- More than one Node process, by design rather than by accident.
- Slow work that must not block the real-time path.
02 — What I Built
Redis under the sockets, queues beside them
Socket.IO runs over a Redis adapter so an emit reaches every process. The expensive work moved off the socket path into BullMQ workers, and anything that runs on a clock moved into Node-Cron.
- Socket.IO over a Redis adapter for rooms and emits that span processes.
- 79 REST endpoints across 15 Mongoose models behind the live layer.
- BullMQ queues for work that must not run inline.
- Twelve Node-Cron schedules for periodic reports and reminders.
03 — What Changed
It scales sideways
Adding a process adds capacity instead of adding a version of the truth. A participant sees the same count as everyone else in the room, regardless of which instance answered them.
- Rooms, counts and leaderboards agree across instances.
- Capacity is a process count rather than a rewrite.
- Slow jobs queue instead of stalling a connection.