@jodit/collab-server
v0.1.7
Published
Collaboration server for Jodit: authoritative patch sequencer over WebSocket with pluggable authentication. Reference implementation of @jodit/collab-protocol.
Maintainers
Readme
@jodit/collab-server
The Jodit Collaboration server: an authoritative patch sequencer over
WebSocket with pluggable authentication and storage. Reference implementation
of @jodit/collab-protocol —
the protocol package doubles as the spec if you prefer to build your own
backend.
Full documentation: https://jodit.github.io/jodit-collaboration/
Quick start
# demo mode: guests allowed, in-memory storage
ALLOW_ANONYMOUS=true npx @jodit/collab-server
# or with docker (compose file in the repo adds Postgres persistence)
docker compose upProgrammatic:
import { start } from '@jodit/collab-server';
const server = await start({
port: 8083,
auth: {
// identity is ALWAYS resolved server-side — the editor only sends a token
checkAuthentication: async (token) => await verifyToken(token),
// allowAnonymous: true, // demo mode: generated guest identities
},
// storage: new PostgresStorage(process.env.DATABASE_URL), // default: memory
});What it does
- WS endpoint
/collab/ws: hello-handshake auth →welcomewith the server-assigned identity + document snapshot (or asinceSeqdelta on clean reconnects); - sequences concurrent submits with OT (
@jodit/collab-protocol), persists every entry before broadcasting, snapshots everySNAPSHOT_EVERYentries; - presence (carets/selections) enriched with server-side identity;
- history/replay API:
GET /collab/docs/:id/history?from&to; - per-connection rate limiting, fail-closed auth defaults.
Environment
| Variable | Default | Purpose |
| -------------------- | --------- | ------------------------------------- |
| PORT | 8083 | HTTP/WS port |
| ROUTE_PREFIX | /collab | URL prefix |
| ALLOW_ANONYMOUS | false | Demo mode: generated guest identities |
| STORAGE | memory | memory | postgres |
| DATABASE_URL | — | Postgres connection string |
| SNAPSHOT_EVERY | 200 | Snapshot cadence (entries) |
| EMPTY_ROOM_TTL_MS | 600000 | Unload idle empty rooms |
| RATE_LIMIT_ENABLED | true | Per-connection flood protection |
| STATIC_DIR | — | Serve a static demo page at / |
License
Commercial — see LICENSE.md. Free to evaluate; a paid license
is required for production use. Read more at https://xdsoft.net/jodit/pro/.
