Loading...
Loading...
Staff · 45 min
Also asked as: Google Docs, Notion, Confluence, Dropbox Paper.
Read it once, then start the timer and work without scrolling.
Design the frontend for a collaborative rich-text editor where multiple people edit the same document at the same time and see each other's cursors.
Everything below is a model answer. You will get far more out of this drill by attempting it cold first — set the timer, talk through it out loud, and only then compare.
A 45-minute phase plan you can practise against a clock.
Interactive · Drill rehearsal timer
6:00
Time remaining in Clarify and scope.
What you should establish before drawing a single box.
Architecture, data, interfaces, and optimisations — the RADIO body.
The half of the answer most candidates skip entirely.
Naming how the system breaks, and what the user sees when it does, is the cheapest way to signal production experience. Work through these before the interviewer has to ask.
The interviewer will challenge you. Rehearse the concession, not just the defence.
Interviewer
Why not just use operational transforms? That is what Google Docs actually does.
Model response
OT is a legitimate choice and it produces smaller payloads, which matters at Google's scale. The cost is that OT requires a central authoritative server to transform every operation against concurrent history, so the correctness burden lives in a service my team may not own. A CRDT moves convergence into the client library, which means peer-to-peer and offline both work without extra server logic. If we already had an OT server and an team maintaining it, I would use it. Building fresh, I take the CRDT and pay for it in metadata size.
Interviewer
Your CRDT document grows forever. That seems like a serious problem.
Model response
It is a real cost and I would not hide it. Yjs keeps tombstones for deleted content so concurrent deletes converge. Mitigation is periodic compaction: snapshot the materialized document server-side, then garbage-collect history older than the snapshot. We lose fine-grained history before the snapshot point, which is why I would keep coarse version snapshots separately. The trade is bounded storage for reduced undo depth on old edits, and I would confirm with product that this is acceptable.
Interviewer
Do you really need three state layers? That sounds over-engineered for an editor.
Model response
The separation is what lets me degrade correctly. If presence and document share a channel and a lifecycle, a presence storm during a large meeting can back-pressure real edits, and a crashed tab leaves a ghost cursor that needs manual cleanup. Splitting them means I can drop presence messages under load with zero correctness impact. If the requirement were five concurrent editors and no offline support I would collapse this and just broadcast whole-document state, and I would say so.
Interviewer
What happens if two people apply conflicting formatting to the same word at the same instant?
Model response
The CRDT will converge deterministically, but converged is not the same as correct-looking. Both marks apply, so a word bolded by one user and italicized by another ends up bold-italic, which is usually what people expect. Where it gets ugly is competing values on the same attribute, like two different heading levels. There the CRDT picks a winner by clientId ordering, which is arbitrary from the user's perspective. I would make attribute conflicts visible rather than silent, and for high-stakes structural changes I would consider a short-lived lock on the block.
Specific signals an interviewer is listening for on this prompt.
Turn one attempt into retained skill.