Hocuspocus

A plug-and-play Yjs WebSocket backend for real-time collaborative editing

Library
npm
v4.6.0
2,537stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum.How we score it →
91/100Excellent
Development Activity88
Maintenance100
Community76
Maturity60
Momentum40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation.How we score it →
79/100Good
Architecture85
Code Quality82
Innovation80
Learning Curve68

Hocuspocus is a collaboration backend built on Yjs, a CRDT (conflict-free replicated data type) library, that lets multiple clients edit the same document in real time over WebSockets with automatic conflict resolution. @hocuspocus/server is the core server package — instantiate a Server, wire in lifecycle hooks (onConnect, onLoadDocument, onStoreDocument, onChange), and it handles syncing Yjs document updates between all connected clients.

The rest of the monorepo builds around that server core: @hocuspocus/provider is the matching client-side connector (commonly paired with editors like Tiptap or ProseMirror), and a family of extension packages (extension-database, extension-redis, extension-s3, extension-sqlite, extension-webhook, extension-throttle, extension-logger) add persistence, horizontal scaling, and observability without touching the core server code. Maintained by Tiptap, which also offers a paid managed cloud version (Tiptap Collab) for teams that don’t want to self-host.

What You Get

  • A Server class that accepts WebSocket connections and syncs Yjs document updates between all connected clients automatically
  • A hook-based extension system (onConnect, onAuthenticate, onLoadDocument, onStoreDocument, onChange) for wiring in auth, persistence, and custom logic
  • Official extension packages for SQLite, Redis (horizontal scaling across server instances), S3, database persistence, webhooks, throttling, and logging
  • A companion @hocuspocus/provider client package and @hocuspocus/transformer for converting between Yjs docs and ProseMirror/Tiptap JSON

Common Use Cases

  • Building real-time collaborative rich-text editors (commonly paired with Tiptap or ProseMirror via the transformer package)
  • Persisting collaborative documents to a database or S3 via the official extension packages instead of writing custom storage logic
  • Scaling collaboration servers horizontally across multiple instances using the Redis extension for shared awareness/state
  • Adding authentication and per-document access control via the onAuthenticate/onConnect hooks before allowing a client to join a document

Under The Hood

Architecture — The Hocuspocus class (packages/server/src/Hocuspocus.ts, ~650 lines) is the central orchestrator: it manages Document instances (each wrapping a Yjs Y.Doc), tracks Connection/ClientConnection objects per WebSocket client, and dispatches the full hook lifecycle to registered extensions on every connect, message, and disconnect event. MessageReceiver and IncomingMessage/OutgoingMessage implement the Yjs sync protocol’s binary message framing over the WebSocket transport, while DirectConnection allows server-side code to read/write a document without an actual client connection (useful for webhooks or migrations).

Tech Stack — TypeScript throughout (98%), structured as a pnpm monorepo where the server core has zero required persistence dependency — SQLite, Redis, S3, and generic database persistence are all separate extension-* packages a consumer opts into. The core depends directly on yjs and ws (or a compatible WebSocket implementation); extensions bring their own client libraries (ioredis for Redis, aws-sdk/@aws-sdk/client-s3 for S3, etc.).

Code Quality — A dedicated tests/ workspace package holds integration-style test suites per concern (server/, provider/, providerwebsocket/, transformer/, extension-redis/, extension-s3/, extension-throttle/), exercising real client/server WebSocket round-trips rather than only mocking Yjs internals — notable for a real-time system where message-ordering and reconnect edge cases are easy to miss with pure unit tests. Sustained release cadence (99 tagged releases, ~13 commits/month) and 83 contributors indicate active maintenance.

API Design — The hook-based extension model (onConnect, onLoadDocument, onStoreDocument, etc., each an async function on a plain object or class instance passed into extensions: []) is the core design decision: it keeps the server itself persistence-agnostic and lets teams compose exactly the extensions they need (e.g. SQLite for a hobby project, Redis + S3 for production scale) without forking the server. The trade-off is that getting a fully working, persisted deployment requires understanding and composing several packages rather than one all-in-one server.

Used by 10 apps in this directory

TypeScript
72%
AGPL 3.0

APITable

Low Code Platforms · Databases

15,526

API-first collaborative spreadsheet-database platform that auto-generates REST APIs and lets teams build internal tools, CRMs, and dashboards without code.

View details
53
Repo Health
77
Technical
60
Dependency
Built with
TypeScript72%
Java22%
Updated 9 months ago
TypeScript
95%
AGPL 3.0

Docmost

Productivity · Note Taking · Collaboration

21,411

Self-hosted collaborative wiki and knowledge base with real-time editing, diagrams, AI assistance, and enterprise access controls — a modern alternative to Confluence and Notion.

View details
89
Repo Health
70
Technical
71
Dependency
Built with
TypeScript95%
Updated yesterday
Python
51%
MIT

Docs

File Storage · CMS

16,733

Open-source collaborative knowledge platform with real-time editing, AI writing tools, and full self-hosting control — built by the French and German governments.

View details
87
Repo Health
81
Technical
72
Dependency
Built with
Python51%
TypeScript42%
Updated 2 days ago
TypeScript
99%
AGPL 3.0

fountain-ink

Blogging

64

A self-hostable, decentralized blogging platform built on Lens Protocol — own your content, audience, and distribution forever.

View details
26
Repo Health
66
Technical
69
Dependency
Built with
TypeScript99%
Updated 6 months ago
TypeScript
61%
EPL-2.0

Huly Platform

Project Management · Team Chat · Collaboration

27,384

Open-source all-in-one workspace that replaces Linear, Jira, Slack, and Notion for product and engineering teams.

View details
90
Repo Health
86
Technical
64
Dependency
Built with
TypeScript61%
Svelte34%
Updated 1 weeks ago
Python
51%
AGPL 3.0

LearnHouse

Learning Management · CMS

2,178

Open-source LMS with AI tutoring, real-time collaboration boards, live code execution, and built-in course monetization — self-hosted in minutes.

View details
89
Repo Health
77
Technical
67
Dependency
Built with
Python51%
TypeScript48%
Updated 3 days ago
Ruby
79%
GPL 3.0

OpenProject

Project Management · Productivity · Collaboration

15,881

The open source project management platform that unifies Gantt charts, agile boards, time tracking, and team collaboration under full self-hosted control.

View details
96
Repo Health
79
Technical
70
Dependency
Built with
Ruby79%
TypeScript13%
Updated today
TypeScript
97%
Other

Outline

Knowledge Management · Collaboration

40,236

A fast, real-time collaborative knowledge base for growing teams built on React, Node.js, and ProseMirror.

View details
91
Repo Health
87
Technical
69
Dependency
Built with
TypeScript97%
Updated yesterday
TypeScript
70%
AGPL 3.0

Plane

Productivity · Project Management · Collaboration

56,127

Open-source project management platform to replace Jira, Linear, and ClickUp — with built-in cycles, real-time collaborative docs, and full self-hosting.

View details
89
Repo Health
82
Technical
77
Dependency
Built with
TypeScript70%
Python26%
Updated 2 days ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers

Search