Real-time Collaboration
Multi-user co-editing with presence, conflict resolution, and offline sync — Figma/Linear/Notion-class collaboration primitives.
Options
Sync / Conflict Resolution Algorithm*
Transport Layer*
Presence & Awareness Features
Offline Behavior*
Decision Points
OT, CRDT (Yjs/Automerge), or last-write-wins?
If yes
CRDTs are the safer default in 2026 — Yjs for text, Automerge for structured trees. OT only if you have a strong reason (compact wire format, existing OT expertise).
If no
Last-write-wins is fine for low-collaboration surfaces (settings forms, occasional spreadsheet edits) where concurrent typing is rare.
Presence indicators (avatars, cursors) required?
If yes
Ship avatars first — cheapest, highest perceived value. Cursors next over an ephemeral channel (CRDT awareness or a throttled WebSocket).
If no
Skip only for single-user-focused surfaces. Presence is what makes collaboration feel alive.
Live cursor positions or just presence dots?
If yes
Cursors at 20-60 Hz over an ephemeral channel. Critical: never persist these — they are throwaway awareness state.
If no
Avatars + last-seen location (section/page) is a good middle ground. Cheaper and gives most of the "someone is here" signal.
Offline editing with sync on reconnect?
If yes
Use CRDTs with local persistence (y-indexeddb). Edits replay deterministically on reconnect with no conflict UI needed.
If no
Block editing when disconnected and show a clear banner — acceptable for low-stakes surfaces but frustrating for document work.
Conflict resolution visible to users or transparent?
If yes
Surface conflicts for structured content where both versions matter (e.g., 'Alice and Bob both renamed this — keep which?'). Rare but necessary for branching workflows.
If no
CRDT/OT transparent merges are the norm for document text. Users should not see a merge UI for concurrent typing.
Per-document ACLs for co-editing?
If yes
Server-authoritative transport required — validate each op against the permission model before broadcasting. Pure P2P cannot enforce this.
If no
Workspace-level permissions are simpler; document-level ACLs mean every op must be checked.
Edit history / time-travel UI?
If yes
Snapshot the CRDT state periodically (hourly, or every N edits) and expose a timeline. CRDTs make state-at-time queries natural via vector clocks.
If no
An undo stack per session is sufficient for most tools. Full time-travel is expensive to store and render.
Inline comments anchored to selections?
If yes
Anchor via stable node IDs (CRDT) or transform positions across ops (OT). Plan for anchor loss when the target is destructively deleted — show a fallback thread list.
If no
Document-level or page-level comments are far simpler and cover most review workflows.
Follow-user mode (screen-share feel)?
If yes
Stream the target's viewport state (scroll, zoom, selection) at ~5-10 Hz on a subscribed channel. Disable on privacy-sensitive docs.
If no
Avatars with "on page X" location indicators cover 80% of the use case without the complexity.
Server-authoritative or peer-to-peer sync?
If yes
Server-authoritative (WebSocket to your own service or Liveblocks). Required for ACLs, persistence, and audit. P2P only for ephemeral cursors/voice on top.
If no
Pure P2P CRDT is viable for fully public local-first apps. Rare in practice — most products need a server to persist state anyway.
Hub-and-spoke or mesh topology for scale?
If yes
Hub-and-spoke via a WebSocket server/room scales to hundreds of participants. Mesh P2P breaks down past ~10 peers due to connection count.
If no
Mesh only works for small rooms (pair programming, design review with ~5 people). Prefer hub for anything larger.
Transport: WebSockets, WebRTC, or SSE?
If yes
WebSocket for durable document state (always). WebRTC as an overlay for cursors and voice when sub-50ms latency matters. SSE for low-edit-rate read-heavy views.
If no
Defaulting to WebSocket alone is the simplest and safe choice for most collaboration products.
Throttle ops for low-bandwidth clients?
If yes
Batch ops on a 50-100ms timer client-side and compress before sending. Critical for mobile and poor-network scenarios.
If no
Acceptable on desktop-only products with assumed good networks. You'll regret it once mobile usage grows.
Cross-document links that update live?
If yes
Subscribe the viewing document to the linked document's summary (title, status) via a pub/sub channel. Budget for the subscription-graph complexity.
If no
Static links with lazy refresh on document open cover most needs and avoid a subscription mesh.
Per-room resource caps (users, ops/sec)?
If yes
Enforce a max concurrent users per doc (~100 is a reasonable ceiling for most CRDT systems) and throttle ops/sec per user. Prevents one runaway session from DOSing the room.
If no
Uncapped is fine early on but will bite you the first time a shared link goes viral. Add caps before incident, not after.
Tradeoffs
Document state grows with edit history — requires garbage collection and snapshotting for long-lived docs
High-frequency ephemeral channel required (20-60 Hz) — do not route through durable storage
Conflict-resolution edge cases multiply — user deletes while offline, teammate edits the same section
Perceived latency drops meaningfully vs server-relayed but requires STUN/TURN infra and NAT-failure fallback
Dependencies
Implementation Examples
Production-grade CRDT library for text and structured data; pairs with y-websocket and y-indexeddb.
CRDT library for rich JSON-like documents with built-in history and sync protocol.
Managed collaboration infrastructure — presence, storage, comments, and CRDT transport as a service.
Public writeup of the OT-based sync engine behind Figma — gold standard reference for server-authoritative design-tool collaboration.
Realtime database backend using OT on JSON documents — powers many collaboration products.