← System Design

Design a Collaborative Editor (Google Docs)

hard
Asked at
Figma
Google
Notion
Figma, Google, Notion

Problem statement

Design a real-time collaborative rich-text editor using CRDTs (Yjs), presence cursors, offline support, document compaction, and awareness — covering OT vs CRDT trade-offs.

Asked In

GoogleNotionFigmaLinearDropbox PaperCoda

Key Challenges

  • ·Optimistic local edits with instant UI feedback and conflict-free rebase
  • ·Operational Transformation (OT) or CRDT for conflict resolution
  • ·Real-time presence, cursors, and selection synchronization via WebSocket
  • ·Offline queue + deterministic reconnect catch-up without data loss
  • ·Virtualized large document rendering with minimal re-renders
★

2-Minute Answer — High-Level TL;DR

Read this before your interview

HLD Interview Focus

I would keep the collaborative editor local-first: keystrokes apply to a local document model immediately, a sync engine encodes ops to peers, and remote ops merge without resetting the user's caret. Presence is a separate channel. Offline edits queue and flush on reconnect. The React layer renders the document model; it does not own the CRDT. The hard parts are caret stability, presence fanout, and not re-rendering the world per op.

→

My Approach: Building the Solution

How to think about this problem

I'll start from two users typing in the same paragraph — what happens to each caret — then design local-first edits, sync boundaries, and presence as a separate plane.

Why This Approach?

Most candidates say 'WebSocket + textarea'. That answer collapses under concurrent edits and offline. Strong answers put a sync engine under a local document model and protect the caret as an invariant.

Collaboration is a jazz trio: everyone hears themselves instantly (local apply), listens to others (remote ops), and the chart (CRDT/OT) keeps the song in one key without a conductor rewriting history mid-solo.

R

Requirements: What Makes a Great Solution?

Clarify scope before designing anything

Requirements Exploration Questions

Ask your interviewer these questions to refine requirements

What editing scope is in MVP?

  • ·Plain text only vs rich text schema
  • ·Formatting depth (bold/italic/headers/lists/tables)
  • ·Max document size and section count

What collaboration depth is expected?

  • ·Max concurrent editors per doc
  • ·Presence granularity (cursor only vs selection + activity)
  • ·Comment-only users vs full editors

What offline behavior is required?

  • ·Read-only offline vs full edit queue
  • ·Reconnect merge expectations
  • ·Data retention in IndexedDB

Functional Requirements

Must Have — MVP

  • ✓Real-time multi-user editing (text + basic formatting)
  • ✓Presence indicators (who is online)
  • ✓Comments and basic suggestions
  • ✓Autosave + document history entry points
  • ✓Offline queue with reconnect sync

Advanced (If Time Permits)

  • +Complex tables/media embeds
  • +Fine-grained permissions and audit trails
  • +Large document virtualization and chunk sync
  • +Cross-tab collaboration + mobile parity

Non-Functional Requirements

Performance

  • ·Local edit latency < 50ms
  • ·Remote sync visible < 200ms
  • ·Initial document open < 2s (typical docs)

Reliability & Consistency

  • ·No data loss across reconnects
  • ·Deterministic convergence after conflicts
  • ·Idempotent retries for write paths

Accessibility & Security

  • ·WCAG 2.1 AA baseline
  • ·Keyboard-first editing navigation
  • ·TLS + strict authz on every write
Premium

The full solution is part of HelloFrontend Pro

The question above is free to read in full. Upgrade to unlock the interactive workspace and the senior-level walkthrough that go with it.

  • Full RADIO-framework walkthrough with architecture diagrams
  • Data model, API design, and rendering strategy trade-offs
  • Performance, accessibility, and offline sections plus a model answer
Unlock the full solution →

Already a member? Log in to open the workspace.

More System Design questions

View all System Design →