@hocuspocus/extension-redis
v4.0.0
Published
Scale Hocuspocus horizontally with Redis
Readme
@hocuspocus/extension-redis
Scale Hocuspocus horizontally across multiple server instances. Uses Redis pub/sub to broadcast document updates and awareness between servers, so clients connected to different instances stay in sync on the same document.
Installation
npm install @hocuspocus/extension-redisUsage
Point every Hocuspocus instance at the same Redis:
import { Server } from "@hocuspocus/server"
import { Redis } from "@hocuspocus/extension-redis"
const server = new Server({
port: 1234,
extensions: [
new Redis({
host: "127.0.0.1",
port: 6379,
}),
],
})
server.listen()Bring your own Redis client
If you already have an ioredis client (including Cluster), pass it in directly instead of host/port:
import RedisClient from "ioredis"
new Redis({
redis: new RedisClient({ host: "127.0.0.1", port: 6379 }),
})Redis handles real-time sync — you still need a persistence extension (e.g. @hocuspocus/extension-sqlite, @hocuspocus/extension-s3, or your own Database) to store documents long-term.
Documentation
Full scaling architecture and multi-instance deployment guide: tiptap.dev/docs/hocuspocus/server/extensions/redis.
License
MIT — see LICENSE.md.
