Skip to main content
CollabKit provides a Yjs provider that bridges a Y.Doc to the server via the existing WebSocket connection. This enables real-time collaborative editing with conflict-free resolution — no additional infrastructure required.
Editors can send Yjs document updates. Viewers can receive and apply Yjs updates, but outbound Yjs writes are blocked for viewer sessions.

Installation

The Yjs provider is exported from a separate entry point. You also need yjs as a peer dependency:

Import

Basic Usage

Constructor

client
CollabKitClient
required
An initialized and connected CollabKitClient instance.
ydoc
Y.Doc
required
A Yjs document instance.
options.documentId
string
required
Unique identifier for the CRDT document within the room. Multiple documents can coexist in the same room by using different IDs.

Properties

Events

synced

Fires when the initial document state has been loaded from the server:

Methods

destroy()

Disconnect the provider and clean up resources:

TipTap Integration

CollabKit’s Yjs provider works with TipTap and its collaboration extension:
Disable TipTap’s built-in history extension when using Collaboration. Yjs has its own undo/redo management.

Multiple Documents

You can create multiple providers for different documents within the same room:

How It Works

The Yjs provider uses CollabKit’s WebSocket connection to synchronize document state:
  1. Initial sync: On creation, the provider sends a crdtSyncRequest to the server, which returns the full document state.
  2. Local changes: When the local Y.Doc is modified, the provider sends the delta as a crdtUpdate message.
  3. Remote changes: The server broadcasts crdtUpdated messages to all other clients, which the provider applies to the local Y.Doc.
  4. Persistence: The server stores the document state in its SQLite database. Documents survive server restarts.
No additional server configuration is needed — CRDT support is built into the CollabKit server.