yjs README

The project's README from github.com/yjs/yjs. As one markdown file: README.md.

Yjs

A CRDT framework with a powerful abstraction of shared data

Yjs is a CRDT implementation that exposes its internal data structure as shared types. Shared types are common data types like Map or Array with superpowers: changes are automatically distributed to other peers and merged without merge conflicts.

Yjs is network agnostic (p2p!), supports many existing rich text editors, offline editing, version snapshots, undo/redo and shared cursors. It scales well with an unlimited number of users and is well suited for even large documents.

:construction_worker_woman: If you are looking for professional support, please consider supporting this project via a "support contract" on GitHub Sponsors. I will attend your issues quicker and we can discuss questions and problems in regular video conferences. Otherwise you can find help on our community discussion board.

Sponsorship

Please contribute to the project financially - especially if your company relies on Yjs. Become a Sponsor

Professional Support

Who is using Yjs

Table of Contents

Overview

This repository contains a collection of shared types that can be observed for changes and manipulated concurrently. Network functionality and two-way-bindings are implemented in separate modules.

Bindings

Name Cursors Binding Demo
ProseMirror                                                   ✔ y-prosemirror demo
Quill ✔ y-quill demo
CodeMirror ✔ y-codemirror demo
Monaco ✔ y-monaco demo
Ace ✔ y-ace
Slate ✔ slate-yjs demo
BlockSuite ✔ (native) demo
Lexical ✔ (native) demo
BlockNote ✔ y-prosemirror demo
Tiptap ✔ y-prosemirror demo
Milkdown ✔ y-prosemirror demo
Superdoc ✔ (native) demo
valtio valtio-yjs demo
immer immer-yjs demo
mutative mutative-yjs demo
React react-yjs demo
React / Vue / Svelte / MobX SyncedStore demo
mobx-keystone mobx-keystone-yjs demo
PSPDFKit yjs-pspdfkit demo
Rows n'Columns ✔ @rowsncolumns/y-spreadsheet

Utilities

Tools that extend the core functionality of Yjs.

y-utility Library with YMultiDocUndoManager (undo/redo across Yjs docs) and YKeyValue (optimized key-value store). yjs-orderedtree 🌳 Class for ordered trees via Y.Map. Handles insert, delete, and move operations for folder-like hierarchies.

Providers

Setting up the communication between clients, managing awareness information, and storing shared data for offline usage is quite a hassle. Providers manage all that for you and are the perfect starting point for your collaborative app.

This list of providers is incomplete. Please open PRs to add your providers to this list!

Connection Providers

y-websocket A module that contains a simple websocket backend and a websocket client that connects to that backend. y-redis, y-sweet, ypy-websocket, yrs-warp and Hocuspocus (see below) are alternative backends to y-websocket. y-webrtc Propagates document updates peer-to-peer using WebRTC. The peers exchange signaling data over signaling servers. Publicly available signaling servers are available. Communication over the signaling servers can be encrypted by providing a shared secret, keeping the connection information and the shared document private. Hocuspocus 🌟 A standalone extensible yjs server with sqlite persistence, webhooks, auth and more. Velt YJs ⭐ Velt A managed Yjs backend with realtime WebSocket sync and persistent storage - no server setup required. Includes offline support with automatic reconnection, version history, end-to-end custom encryption. Additionally it also provides Yjs webhook events, REST API to read and update Yjs documents, and a browser DevTools extension. @liveblocks/yjs ⭐ Liveblocks Yjs provides a fully hosted WebSocket infrastructure and persisted data store for Yjs documents. No configuration or maintenance is required. It also features Yjs webhook events, REST API to read and update Yjs documents, and a browser DevTools extension. teleportal Build your own Y.js sync server: any storage, any JS runtime, any transport. y-sweet A standalone yjs server with persistence to S3 or filesystem. They offer a cloud service as well. @superviz/yjs SuperViz Yjs Provider comes with a secure, scalable real-time infrastructure for Yjs documents, fully compatible with a set of real-time collaboration components offered by SuperViz. This solution ensures synchronization, offline editing, and real-time updates, enabling multiple users to collaborate effectively within shared workspaces. PartyKit Cloud service for building multiplayer apps. @pluv/crdt-yjs Use pluv.io as a full-featured backend for Yjs. pluv.io can either be be used on its fully-managed WebSocket infrastructure, or self-hosted on Cloudflare Workers and Node.js runtimes. Offers a typesafe API with authentication, webhooks, rooms, and more. y-libp2p Uses libp2p to propagate updates via GossipSub. Also includes a peer-sync mechanism to catch up on missed updates. y-dat [WIP] Write document updates efficiently to the dat network using multifeed. Each client has an append-only log of CRDT local updates (hypercore). Multifeed manages and sync hypercores and y-dat listens to changes and applies them to the Yjs document. Matrix-CRDT Use Matrix as an off-the-shelf backend for Yjs by using the MatrixProvider. Use Matrix as transport and storage of Yjs updates, so you can focus building your client app and Matrix can provide powerful features like Authentication, Authorization, Federation, hosting (self-hosting or SaaS) and even End-to-End Encryption (E2EE). yrb-actioncable An ActionCable companion for Yjs clients. There is a fitting redis extension as well. y-atproto A Yjs provider that syncs documents over the AT Protocol (the decentralized protocol behind Bluesky). Documents are stored as ATProto records and real-time updates are delivered via Jetstream. ypy-websocket Websocket backend, written in Python. Tinybase The reactive data store for local-first apps. They support multiple CRDTs and different network technologies. y-webxdc Provider for sharing data in webxdc chat apps. secsync An architecture to relay end-to-end encrypted CRDTs over a central service. y-electric Sync Yjs over ElectricSQL. yjs-cf-ws-provider Cloudflare provider for Yjs based on durable objects. nostr-crdt Sync Yjs over nostr.

Persistence Providers

y-indexeddb Efficiently persists document updates to the browsers indexeddb database. The document is immediately available and only diffs need to be synced through the network provider. y-mongodb-provider Adds persistent storage to a server with MongoDB. Can be used with the y-websocket provider. y-fire A database and connection provider for Yjs based on Firestore.

yjs (yjs/yjs)

Searching Database…

22.9K ·GitHub
Что это такое?Yjs — это CRDT-фреймворк для создания приложений с совместной работой: общие типы данных вроде Map или Array, изменения которых автоматически рассылаются участникам и объединяются без конфликтов слияния.
Это приложение, которое я устанавливаю, или библиотека, которую подключаю в свой код?Это JavaScript-библиотека, которую вы добавляете в своё приложение. Ядро даёт только общие структуры данных — работа с сетью и двусторонние привязки к редакторам вынесены в отдельные модули.
Как добавить её в свой проект?Установите её из npm (npm install yjs) и следуйте руководству Getting Started. Для инструментов разработки понадобятся Node >= 22.0.0 и npm >= 8.0.0.
Нужно ли что-то ещё установить заранее?Только Node >= 22 и npm >= 8 для инструментального окружения; единственная runtime-зависимость самой библиотеки — lib0. Ядру не нужен ни бэкенд, ни база данных — серверы синхронизации это опциональные отдельные модули.
Хватит ли одного ядра, чтобы собрать работающее приложение для совместной работы?Нет — «из коробки» это только общие типы данных. Нужно добавить провайдер для связи и хранения данных (y-websocket, y-webrtc, y-indexeddb) и привязку к вашему редактору или слою состояния.
Кто этим пользуется — проверено ли в продакшене?Разработчики приложений для совместной работы; в README перечислены пользователи в продакшене: Evernote, JupyterLab, Linear, Gitbook, AFFiNE и Proton Docs.
Где это работает?Везде, где работает JavaScript — в основном в браузере для веб-приложений, а также на Node.js для серверов и инструментов. Способ передачи данных зависит от выбранного провайдера.
Будет ли это работать без интернета?Да — работа офлайн это ключевая функция. Провайдер y-indexeddb сохраняет изменения в браузере, так что документ доступен сразу, а позже синхронизируются только различия.
Мой документ обязан проходить через чужой сервер?Зависит от провайдера: y-webrtc синхронизирует данные напрямую между участниками, и даже его сигнальный трафик можно зашифровать общим секретом, чтобы информация о соединении и общий документ оставались приватными.
Как именно изменения попадают от одного пользователя к другому?Через провайдеры: y-websocket подключает клиентов к WebSocket-серверу, y-webrtc синхронизирует напрямую по WebRTC, а ещё есть отдельные серверы (Hocuspocus, y-sweet) или хостинговые варианты вроде Liveblocks.
С какими редакторами и фреймворками он интегрируется?ProseMirror, Quill, CodeMirror, Monaco, Ace, Slate, Lexical, Tiptap, BlockNote и Milkdown — у большинства есть поддержка общих курсоров, плюс привязки для React, Vue, Svelte, MobX, valtio и immer.
Отмена/повтор действий и курсоры доступны сразу?Да — общие типы поддерживают отмену/повтор через Y.UndoManager, снапшоты версий и общие курсоры прямо из коробки.
Можно ли получить профессиональную поддержку?Да — автор проекта предлагает платный контракт на поддержку через GitHub Sponsors с еженедельными видеозвонками, а Synergy Codes консультирует по решениям для совместного редактирования в реальном времени.
Creator
yjs
Size
72.1 MB
Stars
22.9K
Age
12y
Commits · 90 Days