AI agents: fetch the documentation index at llms.txt. Markdown versions are available by appending .md to any page URL, including this page's markdown.
Collaborative editing with Yjs
Set up real-time, multi-user collaborative editing using CRDTs, presence tracking, and rich-text editor integration.
Regular fields use server-sequenced LWW sync. Collaborative fields use Yjs CRDTs for character-level merge: no central server needed for conflict resolution.
Architecture overview
Each client binds to a local Yjs document that syncs through the shared WebSocket.
flowchart TB
subgraph Client A
EA[Editor] --> YA[Y.Doc]
YA --> WA[WebSocket]
end
subgraph Client B
EB[Editor] --> YB[Y.Doc]
YB --> WB[WebSocket]
end
subgraph Server
WA --> SS[Sync Server]
WB --> SS
SS --> Redis[(Redis)]
SS --> PubSub[PubSub]
PubSub --> SS
SS --> DB[(Database)]
end- Demand-driven sessions: Live editing starts only when 2+ users view a document and one is editing, cutting server usage by ~96%.
- Shared WebSocket: Yjs updates piggyback on the existing sync connection.
- Standard sync fallback: If live editing goes down, no data is lost.