advanced

Collaborative editor basics

Discuss realtime transport, ordering, conflict resolution, presence, snapshots, and offline merge basics.

Collaborative editors sync document changes across clients in real time while preserving intent under concurrent edits. Transport uses WebSockets or WebRTC data channels. Conflict resolution options include Operational Transformation (OT), CRDTs, or last-write-wins for simpler fields.

Server assigns operation ordering or merges CRDT states. Periodic snapshots plus operation log enable recovery and offline replay. Presence shows cursors and selections; permissions gate edit versus view.

On interviews: compare OT versus CRDT at high level, explain reconnect after disconnect, and sketch storage for document versions.

Common pitfalls: last-write-wins losing concurrent edits in rich text; no compaction of operation log; editing binary files like text.

The trade-off is flexibility versus complexity—know when the simpler path is enough.

Checklist:

  • Choose OT or CRDT for document model.
  • Real-time transport with reconnect sync.
  • Snapshot plus operation history for recovery.
  • Presence and permission layers on top.