CRDT library for building realtime collaborative apps
open sourceMITfree
Yjs is a CRDT library for realtime collaboration: it exposes shared types (maps, arrays, text and XML) that you change like ordinary data structures, and every change syncs automatically between peers and merges without conflicts. It works offline, storing state in a local database such as IndexedDB and syncing later, and needs no central server: providers sync it over WebSocket (y-websocket), WebRTC (y-webrtc), Matrix and more, and persist it in IndexedDB, LevelDB or Redis. An Awareness CRDT handles presence such as cursors, and bindings make editors collaborative, among them ProseMirror, Quill, CodeMirror and Monaco, and editors such as Lexical build on it. It has ports to other languages (Yrs in Rust, with bindings for Python, Ruby, Swift and more), and hosted backends such as Y-Sweet, Liveblocks and Hocuspocus Cloud from the makers of Tiptap. Kevin Jahns builds and manages it.
Problems it solves
- let several people edit the same document at once in my web app, like Google Docs
- sync app state between browsers and keep working offline without merge conflicts
- add collaborative cursors and live editing to my rich text editor
Features
- shared types: Map, Array, Text and XML
- automatic conflict-free merging
- offline support with IndexedDB persistence
- network agnostic: WebSocket, WebRTC and other providers
- Awareness CRDT for presence and cursors
- editor bindings for ProseMirror, Quill, CodeMirror, Monaco and more
- ports to Rust (Yrs) and other languages