Yjs
Liveblocks Yjs connects a Liveblocks room to a Y.Doc, including Yjs shared
types and awareness. Liveblocks persists the Yjs document and synchronizes it
between clients.
LiveText is our newer choice for text-editor integrations. It stores collaborative text directly in Storage, is much more efficient, and works with different editor adapters. Read text editing to compare the two approaches.
Y.Doc
Y.Doc is the core data structure used by
Yjs. It is a JSON-like object that represents the state of a collaborative
document. It is used to store the content of the document, and to synchronize it
between clients. In Liveblocks, get the current room’s Y.Doc with
getYjsProviderForRoom.
Shared types in Yjs are CRDT-backed
data structures (like maps, arrays, and text) stored inside a Y.Doc that
automatically synchronize and merge changes across multiple clients without
conflicts.
Version history
Create version snapshots of your Yjs document, and let users browse, preview,
and restore them.
useHistoryVersions
lists a room’s versions, and
useHistoryVersionYjsData
returns a version as a binary Yjs update, which you can apply to a fresh Y.Doc
to read its contents.
If you’re using our Tiptap, BlockNote, or Lexical plugins, ready-made
HistoryVersionPreview
components preview and restore versions for you. Learn how to set this up in our
version history guide.
Get started
Choose a starting point for your Yjs-backed editor.