🔍

Yjs Collaborative Demo

This demo showcases real-time collaborative text editing using Yjs (Yet Another JSON) CRDT library.

Features

  • Real-time collaboration: Multiple users can edit the same document simultaneously
  • Conflict-free updates: Yjs automatically merges concurrent edits without conflicts
  • Server-Sent Events: Uses SSE for real-time updates (no WebSockets required)
  • Document persistence: Changes are broadcast to all connected clients
  • Client tracking: Shows the number of connected clients

How it works

  1. The <doc-provider> component connects to a Yjs-enabled Durable Object
  2. Each client maintains a local Yjs document that syncs with the server
  3. Local changes are sent to the server via POST requests
  4. Remote changes are received via Server-Sent Events
  5. Yjs automatically handles conflict resolution and document merging

Try it out

Open this page in multiple browser tabs or share the URL with others to see real-time collaboration in action.

View Demo

demo components yjs collaborative published