Registry / database / y-redis

y-redis

JSON →
library1.0.3jsnpmunverified

Redis persistence adapter for Yjs, a CRDT-based collaborative editing framework. Current stable version 1.0.3, with irregular release cadence. Provides a Redis backend to persist Yjs documents, enabling durable storage and retrieval of shared data structures. Key differentiator: integrates seamlessly with Yjs's internal persistence API, allowing real-time collaboration with Redis as a storage layer. Supports automatic document recovery and synchronous writes. Requires Yjs ^13.0.2 as a peer dependency. Note: This package is labeled as work in progress and may have limited features or stability compared to other Yjs persistence adapters.

database
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Named export in ESM; default import is incorrect.

import { yRedisPersistence } from 'y-redis'

ESM-only since version 1.0; CJS require may fail if bundler does not handle ESM.

import { configure } from 'y-redis'

Shows how to initialize a Redis persistence adapter for a Yjs document, bind it, and retrieve persisted state. Includes environment variable for Redis URL.

import * as Y from 'yjs' import { configure } from 'y-redis' const doc = new Y.Doc() const persistence = configure({ redisUrl: process.env.REDIS_URL ?? 'redis://localhost:6379', docName: 'my-doc' }) // Bind persistence to doc persistence.bindDoc(doc) // Now doc is automatically persisted to Redis // To retrieve later: const doc2 = new Y.Doc() persistence.bindDoc(doc2) // doc2 will be synced with Redis data
Debug
Known footguns
gotchay-redis is marked as 'work in progress' and may have limited features or stability. Not recommended for production use without thorough testing.
breakingVersion 1.0 switched from CommonJS to ESM-only exports. CJS require() will break in Node.js without proper bundler configuration.
deprecatedThe `setPersistence` function from previous versions (0.x) is removed in v1.0. Use `configure` and `bindDoc` instead.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
10 hits · last 30 days
gptbot
3
ahrefsbot
1
amazonbot
1
Resources