Esta página se muestra en inglés. Una traducción al español está en curso.
ConfigsMay 19, 2026·3 min de lectura

Yjs — High-Performance CRDT Framework for Real-Time Collaboration

A modular CRDT implementation that enables real-time collaborative editing in any application, with network-agnostic sync providers for WebSocket, WebRTC, and more.

Listo para agents

Este activo puede ser leído e instalado directamente por agents

TokRepo expone un comando CLI universal, contrato de instalación, metadata JSON, plan según adaptador y contenido raw para que los agents evalúen compatibilidad, riesgo y próximos pasos.

Needs Confirmation · 66/100Política: confirmar
Superficie agent
Cualquier agent MCP/CLI
Tipo
Skill
Instalación
Single
Confianza
Confianza: Established
Entrada
Quick Use
Comando CLI universal
npx tokrepo install fc153aa0-535b-11f1-9bc6-00163e2b0d79

Introduction

Yjs is a high-performance CRDT (Conflict-free Replicated Data Type) framework written in JavaScript. It allows multiple users to edit the same data concurrently without conflicts. Yjs is editor-agnostic and works with Tiptap, ProseMirror, Monaco, CodeMirror, Quill, and many other editors.

What Yjs Does

  • Merges concurrent edits automatically without a central server
  • Provides shared data types: Text, Array, Map, and XML Fragment
  • Syncs state over WebSocket, WebRTC, or any custom transport
  • Supports offline editing with automatic reconciliation on reconnect
  • Tracks awareness (cursor positions, user presence) across peers

Architecture Overview

Yjs represents shared state as a document (Y.Doc) containing typed structures. Each edit is encoded as an update operation that can be applied in any order. The CRDT algorithm ensures all peers converge to the same state regardless of message ordering. Providers handle transport: y-websocket for client-server, y-webrtc for peer-to-peer, and y-indexeddb for local persistence.

Self-Hosting & Configuration

  • Install yjs and a provider (y-websocket, y-webrtc, or y-indexeddb)
  • Run the y-websocket server: HOST=localhost PORT=1234 npx y-websocket
  • Bind shared types to your editor using bindings (e.g., y-prosemirror, y-monaco)
  • Persist documents server-side with LevelDB or a custom storage adapter
  • Scale horizontally by partitioning documents across WebSocket server instances

Key Features

  • Sub-millisecond merge performance even with large documents
  • Works offline-first with sync on reconnect
  • Awareness protocol for live cursors and user presence
  • Undo/redo manager with per-user scope
  • Sub-document support for lazy loading parts of a large document

Comparison with Similar Tools

  • Automerge — Rust-based CRDT, better for structured data; Yjs is faster for text
  • ShareDB — OT-based, requires a central server; Yjs is decentralized
  • Liveblocks — managed service with CRDT under the hood; Yjs is self-hostable
  • Fluid Framework — Microsoft-backed, more opinionated architecture
  • Gun.js — decentralized database with eventual consistency, different use case

FAQ

Q: Which editors does Yjs support? A: Tiptap, ProseMirror, CodeMirror, Monaco, Quill, Slate, Lexical, and others via official or community bindings.

Q: Can Yjs work without a server? A: Yes, use y-webrtc for peer-to-peer sync or y-indexeddb for local-only persistence.

Q: How does conflict resolution work? A: Yjs uses CRDTs, so all concurrent edits are merged deterministically. No conflicts require manual resolution.

Q: How large can documents get? A: Yjs handles documents with millions of operations efficiently through incremental encoding and garbage collection.

Sources

Discusión

Inicia sesión para unirte a la discusión.
Aún no hay comentarios. Sé el primero en compartir tus ideas.

Activos relacionados