by Leila S.

Hocuspocus is a plug-and-play WebSocket collaboration backend built on Y.js, enabling real-time collaborative editing with persistence, scaling, and webhook integrations. Ideal for developers building collaborative apps with Tiptap or any ProseMirror-based editor.
Hocuspocus is a plug-and-play Y.js collaboration backend that exposes a WebSocket server for real-time document synchronization. It ships as a monorepo of focused packages: a core server, storage extensions (SQLite, S3, database, Redis), and a client-side provider. Typical buyers are Node.js teams building collaborative editors (Tiptap, ProseMirror, CodeMirror) who need a self-hosted sync server.
cli/ - Command-line entry point; starts a Hocuspocus server with flags for port, webhooks, SQLite, and S3common/ - Shared TypeScript types, auth helpers, close-event constants, awareness utilities, and routing key logicextension-database/ - Generic database extension base class (Database) for custom persistence adaptersextension-logger/ - Structured request/event logger extension (Logger)extension-redis/ - Redis pub/sub extension (Redis) for multi-server horizontal scalingextension-s3/ - S3 / S3-compatible object storage extension (S3) for document persistenceextension-sqlite/ - SQLite persistence extension (SQLite) using better-sqlite3extension-throttle/ - Rate-limiting / throttle extension for connection controlextension-webhook/ - Outbound webhook extension (Webhook) that POSTs lifecycle events to an HTTP endpointprovider/ - Browser/Node WebSocket client provider (HocuspocusProvider, HocuspocusProviderWebsocket)provider-react/ - React hooks wrapping the providerserver/ - Core WebSocket server (Server) — the central orchestratortransformer/ - Y.js document transformation utilities (Tiptap JSON, Prosemirror)npm install @hocuspocus/server @hocuspocus/common
npm install @hocuspocus/extension-logger
npm install @hocuspocus/extension-sqlite
npm install @hocuspocus/extension-database
npm install @hocuspocus/extension-redis
npm install @hocuspocus/extension-s3
npm install @hocuspocus/extension-throttle
npm install @hocuspocus/extension-webhook
npm install @hocuspocus/provider
npm install yjs
# SQLite native module
npm install better-sqlite3
# Redis (if using extension-redis)
npm install ioredis
# S3 (if using extension-s3)
npm install @aws-sdk/client-s3
Spin up an isolated sandbox and run it server-side — no local setup.
Tetrees AI Review of this version
This TypeScript cli / script completed archive review. Structure, dependency manifests, documentation, functional source, and common risk patterns were checked by the Tetrees verification pipeline; runtime phases are stated separately.
Deterministic AVCP artifact review
Pipeline avcp-2026-08-04.1 · SHA-256 033afbb415a12830…
This version-scoped review deterministically inspects the submitted archive for structure, dependencies, documentation, functional source, and common malicious or high-risk signals. Build and test phases are reported as passed only after an isolated sandbox audition. It is not a guarantee of perfect security.
Reviewed Aug 4, 2026
Push this product straight into your AI IDE, web builder or cloud IDE.
Connect Tetrees to a compatible AI IDE, list products you own, and request the verified ZIP without exposing seller upload controls.
No reviews yet.
Sign in to join the discussion
Loading discussion…
No iOS/Android linking required. better-sqlite3 requires a native build; ensure node-gyp prerequisites (Python, C++ compiler) are present on the build machine.
source/ directory into your project root, e.g. src/hocuspocus/.tsconfig.json:{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@hocuspocus/server": ["src/hocuspocus/server/src"],
"@hocuspocus/common": ["src/hocuspocus/common/src"],
"@hocuspocus/extension-sqlite": ["src/hocuspocus/extension-sqlite/src"],
"@hocuspocus/extension-logger": ["src/hocuspocus/extension-logger/src"],
"@hocuspocus/extension-redis": ["src/hocuspocus/extension-redis/src"],
"@hocuspocus/extension-s3": ["src/hocuspocus/extension-s3/src"],
"@hocuspocus/extension-webhook": ["src/hocuspocus/extension-webhook/src"],
"@hocuspocus/extension-throttle": ["src/hocuspocus/extension-throttle/src"],
"@hocuspocus/provider": ["src/hocuspocus/provider/src"]
}
}
}
AWS_ACCESS_KEY_ID=your_key
AWS_SECRET_ACCESS_KEY=your_secret
AWS_REGION=us-east-1
ioredis connection options directly to the Redis extension constructor.@hocuspocus/server → Server. Call server.listen() to start.import { Server } from '@hocuspocus/server'
const server = new Server({
port: number,
extensions: Extension[],
onConnect?: (data: onConnectPayload) => Promise<any> | any,
onAuthenticate?: (data: onAuthenticatePayload) => Promise<any> | any,
onLoadDocument?: (data: onLoadDocumentPayload) => Promise<any> | any,
onStoreDocument?: (data: onStoreDocumentPayload) => Promise<any> | any,
onDisconnect?: (data: onDisconnectPayload) => Promise<any> | any,
})
server.listen(): void
server.destroy(): Promise<void>
The central WebSocket orchestrator. Pass hook callbacks and extension instances. Call listen() to bind the port and begin accepting connections.
import { Logger } from '@hocuspocus/extension-logger'
new Logger({
log?: (message: string) => void, // defaults to console.log
})
Drop into the extensions array to receive structured log output for every connection, authentication, and document lifecycle event. Accepts a custom log function to redirect output to your preferred logger (winston, pino, etc.).
import { SQLite } from '@hocuspocus/extension-sqlite'
new SQLite({
database?: string, // file path or ':memory:', defaults to ':memory:'
})
Persists Y.js document state to a SQLite file using better-sqlite3. Use :memory: for ephemeral development sessions and a file path for durable single-node deployments.
import { Redis } from '@hocuspocus/extension-redis'
new Redis({
host: string,
port: number,
// any ioredis options
})
Enables horizontal scaling across multiple Hocuspocus server instances via Redis pub/sub. All nodes share document state without direct inter-process connections.
import { Webhook } from '@hocuspocus/extension-webhook'
new Webhook({
url: string,
secret?: string,
events?: string[],
})
POSTs JSON payloads to the configured URL on document lifecycle events (connect, disconnect, change, store). Use the secret to verify HMAC signatures on your HTTP endpoint.
A quick local server persisting documents to disk. Suitable for a single developer or staging environment.
import { Server } from '@hocuspocus/server'
import { Logger } from '@hocuspocus/extension-logger'
import { SQLite } from '@hocuspocus/extension-sqlite'
const server = new Server({
port: 1234,
async onConnect({ requestParameters }) {
console.log('Client connected', requestParameters.get('room'))
},
extensions: [
new Logger(),
new SQLite({ database: './collab.sqlite' }),
],
})
server.listen()
Multi-node deployment with Redis for cross-instance sync and S3 for durable document storage.
import { Server } from '@hocuspocus/server'
import { Logger } from '@hocuspocus/extension-logger'
import { Redis } from '@hocuspocus/extension-redis'
import { S3 } from '@hocuspocus/extension-s3'
const server = new Server({
port: Number(process.env.PORT) || 1234,
async onAuthenticate({ token }) {
if (token !== process.env.AUTH_TOKEN) {
throw new Error('Unauthorized')
}
},
extensions: [
new Logger(),
new Redis({
host: process.env.REDIS_HOST ?? '127.0.0.1',
port: 6379,
}),
new S3({
bucket: process.env.S3_BUCKET!,
region: process.env.AWS_REGION ?? 'us-east-1',
}),
],
})
server.listen()
Notify an external API whenever a document is stored, using the Webhook extension with HMAC signing.
import { Server } from '@hocuspocus/server'
import { SQLite } from '@hocuspocus/extension-sqlite'
import { Webhook } from '@hocuspocus/extension-webhook'
const server = new Server({
port: 1234,
extensions: [
new SQLite({ database: ':memory:' }),
new Webhook({
url: 'https://api.example.com/hocuspocus/events',
secret: process.env.WEBHOOK_SECRET,
}),
],
})
server.listen()
// Graceful shutdown
process.on('SIGTERM', async () => {
await server.destroy()
process.exit(0)
})
cli/ - Meow-based CLI binary; parses --port, --sqlite, --s3, --webhook flags and boots a Server instance with the appropriate extensions.common/ - Exports shared types (types.ts), auth helpers (auth.ts), close-event constants (CloseEvents.ts), awareness array conversion (awarenessStatesToArray.ts), routing key utils (routingKey.ts), and SkipFurtherHooksError.extension-database/ - Abstract Database extension; subclass it to implement fetchPayload and storePayload for any custom data store.extension-logger/ - Logger class that hooks into all server lifecycle events and emits formatted log lines.extension-redis/ - Redis extension using ioredis pub/sub to broadcast document updates across server replicas.extension-s3/ - S3 extension wrapping the AWS SDK to load and persist Y.js binary document states as S3 objects.extension-sqlite/ - SQLite extension using better-sqlite3 for synchronous local file persistence.extension-throttle/ - Throttle extension enforcing connection and message rate limits per client.extension-webhook/ - Webhook extension that serializes lifecycle payloads and POSTs them with optional HMAC signatures.provider/ - Client-side HocuspocusProvider and HocuspocusProviderWebsocket; manages WebSocket connection, reconnection, awareness, and Y.js sync protocol.provider-react/ - React hooks (e.g., useHocuspocus) wrapping the provider for component-level usage.server/ - Core Server class: WebSocket upgrade handling, document management, extension pipeline, and hook orchestration.transformer/ - Utilities to convert Y.js document state to/from Tiptap JSON or ProseMirror documents.better-sqlite3 build failure on CI: install python3, make, and g++ before npm install; on Alpine Linux add apk add python3 make g++."type": "module" in your package.json or use a bundler (esbuild, Vite) with ESM output.AWS_REGION not picked up by S3 extension: always pass region explicitly in the S3 constructor rather than relying solely on the environment variable.routingKey configuration; mismatched keys silently drop updates.Error instance (not a string) inside onAuthenticate; the server maps the error message to the WebSocket close reason.SkipFurtherHooksError misuse: import it from @hocuspocus/common, not from @hocuspocus/server; throwing it inside a hook short-circuits the remaining extension chain without treating it as an error.I have the Hocuspocus source code in `source/` and its integration guide in `USAGE.md`.
The upstream package is `hocuspocus` (packages: @hocuspocus/server, @hocuspocus/common,
@hocuspocus/extension-sqlite, @hocuspocus/extension-logger, @hocuspocus/extension-redis,
@hocuspocus/extension-s3, @hocuspocus/extension-webhook, @hocuspocus/provider).
Please integrate Hocuspocus into my existing Node.js/TypeScript project step by step:
1. Read `USAGE.md` fully before writing any code.
2. Install the required dependencies listed in the "Required dependencies" section.
3. Create a `src/collab-server.ts` file that boots a `Server` with the Logger and SQLite
extensions, listening on port 1234.
4. Wire the server startup into my existing Express app so it shares the HTTP server
(or starts independently if that is simpler).
5. Add an `onAuthenticate` hook that validates a Bearer token from the WebSocket
handshake headers using my existing auth middleware.
6. If I ask for Redis scaling, add the Redis extension using `REDIS_HOST` and
`REDIS_PORT` environment variables.
7. Show me where to add the client-side `HocuspocusProvider` in my frontend, importing
from `@hocuspocus/provider`.
8. Do not invent any APIs; use only the exports documented in `USAGE.md` and visible
in `source/`.
Hocuspocus is released under the MIT License. See source/LICENSE.md if present in your copy, or refer to the upstream repository. The upstream npm packages are published under the @hocuspocus scope by ueberdosis / Tiptap.
This product’s unique contribution is clean room implementation of valuable code block into AVCP compatible standard.
The full install guide and integration prompts unlock after purchase.
Automation, Utilities & Developer Tools
Free