Skip to main content

Documentation Index

Fetch the complete documentation index at: https://superdoc-caio-toolbar-formatting-marks-button-opt-in.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

YHub is a Yjs backend for teams that need attribution, activity, revision-history, or rollback workflows.
YHub is in beta and requires Node.js 22+. Validate licensing (AGPL or proprietary) and infrastructure requirements before production use. Production YHub typically pairs Redis with Postgres and an object store (S3 or MinIO) for persisted update blobs; see YHub’s setup docs for the exact architecture. The bundled local server in our example is intentionally local-only (Redis + Postgres, no object store) and is not production infrastructure.

When to choose YHub

Reach for YHub when:
  • You need built-in attribution or per-update authorship tracking.
  • You need revision history, changesets, or rollback APIs as a first-class concept.
  • You’re comfortable operating Redis and Postgres for collaboration state.
For most teams without those requirements, Hocuspocus is a simpler self-hosted starting point, and Liveblocks covers the managed path.

Client setup

YHub speaks the standard y-websocket protocol, so the SuperDoc client uses WebsocketProvider from y-websocket. No YHub-specific provider class is needed. The snippet below connects to the bundled local SuperDoc example server. Production YHub deployments may use a different URL and auth parameter shape (for example, yauth JWT params and /ws/{org}/{docid} style paths). Check your deployment’s docs.
npm install yjs y-websocket
import * as Y from "yjs";
import { WebsocketProvider } from "y-websocket";
import { SuperDoc } from "superdoc";

const documentId = "document-123";
const ydoc = new Y.Doc();
const provider = new WebsocketProvider(
  "ws://127.0.0.1:8081/v1/collaboration",
  documentId,
  ydoc,
  {
    params: {
      token: "YOUR_PRIVATE_TOKEN",
      userId: "user-123",
    },
  },
);

// Guard against the `sync` event firing on reconnect after a network drop.
let superdoc;
provider.on("sync", (isSynced) => {
  if (!isSynced || superdoc) return;
  superdoc = new SuperDoc({
    selector: "#editor",
    user: { name: "User 123", email: "user-123@example.com" },
    modules: {
      collaboration: { ydoc, provider },
    },
  });
});
For the bundled local server, params.token is the shared secret and params.userId is the identifier recorded for attribution. In production, use the auth flow configured for your YHub deployment.

Server

Running a YHub server requires Redis and Postgres. See the bundled local server example for a working setup with Docker Compose. Use it as a starting point, not as a production deployment. For production, follow YHub’s own setup guide and pair it with your existing auth, persistence, and ops tooling.

Resources

SuperDoc + YHub example

Complete React + Vite client paired with the bundled local server

Bundled YHub server

Local Node + Redis + Postgres reference for development

YHub repo

Upstream project, setup, and licensing

YHub API

Attribution, activity, changesets, rollback

Next steps

Self-hosted overview

Compare YHub with Hocuspocus and the SuperDoc Yjs reference server

Client configuration

All SuperDoc collaboration options and events