#37EasyMedia Streaming & Storage

Create a Document Management System like Wikipedia, Notion or Google Docs

ASKED IN INTERVIEWS AT:GoogleFlipkartNotionAmazon

EXECUTIVE SUMMARY & PROBLEM STATEMENT

Design a collaborative document workspace supporting block-based content editing, real-time collaboration with CRDTs, revision history, and full-text search.

SCALE ESTIMATION & TRAFFIC ENVELOPE

DAILY ACTIVE USERS / TPS20 Million DAU, 500 Million documents
READ / WRITE TRAFFIC RATIOFrequent small block updates
5-YEAR STORAGE CAPACITYDocument trees stored in JSONB in PostgreSQL + Elasticsearch

FUNCTIONAL REQUIREMENTS

  • [1]Create and organize hierarchical documents with nested blocks
  • [2]Collaborative real-time editing
  • [3]Full revision history and rollback

NON-FUNCTIONAL REQUIREMENTS

  • •Local-first editing with zero latency
  • •Conflict-free concurrent merges
  • •Full-text search across user workspaces

CORE ARCHITECTURAL COMPONENTS

WebSocket Sync Server
Yjs / Automerge CRDT Engine
PostgreSQL Block Store
Elasticsearch Search Cluster
S3 Media Attachment Bucket

DATA SCHEMA & PERSISTENCE

Blocks: block_id, document_id, parent_id, type, content_json, version

DISTRIBUTED TRADE-OFFS & FAILURE MODES

  • ⟡CRDTs eliminate complex central locking servers by allowing mathematical convergence of concurrent edits on both client and server.