Real-time collaboration

A collaborative rich text editor you host.

Several people type in one document at once, with live cursors and presence, on a server you run.

Details

The editor includes a Yjs CRDT engine, so edits from several people merge without one person’s typing replacing another’s. You connect it to a Yjs provider, and a collaboration server is included for you to run on your own infrastructure. It is part of every license.

Who runs what

The engine is ours. The server is yours.

In the editorPer-node CRDT sync for text and formatting, live cursors, presence and a shared review ledger.
On your infrastructureThe included WebSocket server, with signed room tokens, stored state and an origin allowlist.
Not a hosted serviceYou operate the server: TLS, secrets, storage and scaling are your responsibility.

Attach the editor to a shared document

Yjs is a peer dependency: you load Yjs and a provider (WebSocket, WebRTC or Hocuspocus) and pass them in. After attaching, call editor.collab.getStatus() to confirm that the CRDT mode is active.

import * as Y from "yjs";
import { WebsocketProvider } from "y-websocket";

const ydoc = new Y.Doc();
const provider = new WebsocketProvider("wss://collab.example.com", docId, ydoc);

editor.collab.attach({
    doc: ydoc,
    provider: provider,
    user: { id: "alice", name: "Alice", color: "#2563eb" },
    textSync: "crdt",      // per-node Yjs CRDT; load crdt-engine.min.js first
    requireCrdt: true       // do not silently fall back to legacy snapshots
});

Run the collaboration server

The included server supports signed, room-scoped tokens, durable state, a browser-origin allowlist and a per-room connection limit. Use all four in production, terminate TLS at your proxy, and do not expose an open WebSocket endpoint. A Redis URL on every replica relays updates between server instances.

RTE_COLLAB_SECRET="use-a-long-random-secret"
RTE_COLLAB_PERSIST="/var/lib/rte-collab"
RTE_COLLAB_ALLOWED_ORIGINS="https://app.example.com,https://admin.example.com"
RTE_COLLAB_MAX_CONNECTIONS_PER_ROOM="100"
node server.js

Before you choose it for collaboration

  • There is no uptime commitment from us for your server. Vendors with a hosted collaboration service publish one. Here you run the server, so availability depends on your operations.
  • Treat every collaborator as untrusted input. Remote edits are written into the live document. The editor filters executable content as it arrives, and your server should still sanitize what it stores.
  • Check who may join a room. Mint the room token on your server only after you have verified that the user may open that document.
  • No add-on to buy: collaboration is in every license, from $129 one-time. See pricing, and the self-hosted editor page for what hosting leaves to you.