Collaborative Docs
Google-Docs-style editing — every keystroke, broadcast live, forever.
Keep edits flowing to every collaborator in real time through a Monday-morning login wave, a dead gateway, and a split link.
Every keystroke is an op that must fan out to every open session live — this is a write-and-broadcast workload, not a cache-friendly read path. The op log (stream) is the durable backbone; persistence workers drain it into the doc store. Cold document opens are rare enough to serve from a snapshot cache instead of replaying the whole log.
Components in play
- Edge LB — Spreads incoming connections across the gateway fleet.
- WebSocket gateway — Holds long-lived sessions; routes ops to a session server and snapshot reads to the cache.
- Doc session service — Applies ops (OT/CRDT) and broadcasts them to every participant on the doc.
- Op log — Durable, ordered log of every op — the source of truth for replay.
- Persistence workers — Drain the op log into periodic snapshots in the doc store.
- Doc store — Durable home for documents and their op history.
- Snapshot cache — Serves cold document opens from the latest snapshot instead of replaying the log.
Graded on these SLOs
- ≥ 95.00%Ops land
- ≤ 180 msBroadcast p99
- ≥ 12k rpsSustain the edit rate
- ≤ 90%Headroom
- ≤ 15Lean footprint
The brief
Design the real-time backend for a collaborative document editor like Google Docs. Every keystroke is an op that must apply and broadcast to every other open session on that document instantly — while the document itself stays durable and every participant sees a consistent final state.
Functional
- Apply a rider's op and broadcast it to every other session on the doc
- Persist documents durably so nothing is lost on a crash
- Open a document instantly, even cold, without replaying its whole history
Non-functional
- Ops fan out live — this is a write-and-broadcast workload, not read-heavy
- A gateway or session-server death can't drop in-flight edits
- A network split inside the region can't sever collaborators from each other
Warm-up: design decisions
Optional theory to prime the calls a senior engineer would make before you build.
Solving is a Pro feature
Unlock the on-canvas AI design coach, per-run design reviews, the chaos simulator and all 12 problems for $15/month.
- AI design coach on your canvas — pins failure points & over-engineering
- Honest AI design review on every run
- All 12 problems + unlimited chaos simulator
- Points, levels & leaderboard