Skip to main content
A minimal Yjs WebSocket server we ship as a reference implementation for prototypes and local development.
Use this package for prototypes and local development. It does not include production auth, persistence, scaling, or observability.For production self-hosted collaboration, compare the available Yjs servers. YHub is worth a look if you need attribution or revision history.SuperDoc only needs a Yjs document and provider: pass { ydoc, provider } to modules.collaboration.

Installation

Quick start

Server

Client

The SuperDoc JS collaboration contract is provider-agnostic: always pass { ydoc, provider } in modules.collaboration.

Builder API

The CollaborationBuilder provides a fluent interface:

Hooks

onLoad (Required)

Load document state from storage:

onAutoSave (Required)

Save document state to storage:

onAuthenticate (Optional)

Validate users connecting to documents:

onChange (Optional)

React to document changes (fires on every edit):

Storage examples

Error handling

Production deployment

Docker

Environment variables

Health check

Security

1

Use WSS in production

Always use encrypted WebSocket (wss://) in production
2

Implement authentication

Use the onAuthenticate hook to validate users
3

Validate document IDs

4

Rate limit connections

Limit connections per user to prevent abuse

Resources

SuperDoc Yjs example

Complete working example with a Yjs server

Node SDK backend

Server-side document operations alongside the realtime layer

Next steps

Configuration

Client-side options, events, and hooks

Hocuspocus Alternative

Use TipTap’s Yjs server instead