• DocsDocs
  • PricingPricing
Book a demo
Sign in
Sign in
Book a demo
    • Ready-made features
      • AI Copilots
        AI Copilots

        In-app AI agents that feel human

      • Comments
        Comments

        Contextual commenting

      • Multiplayer Editing
        Multiplayer Editing

        Realtime collaboration

      • Notifications
        Notifications

        Smart alerts for your app

      • Presence
        Presence

        Realtime presence indicators

    • Platform
      • Monitoring Dashboard
        Monitoring Dashboard

        Monitor your product

      • Realtime Infrastructure
        Realtime Infrastructure

        Hosted WebSocket infrastructure

    • Tools
      • Examples

        Gallery of open source examples

      • Next.js Starter Kit

        Kickstart your Next.js collaborative app

      • DevTools

        Browser extension for debugging

      • Tutorial

        Step-by-step interactive tutorial

      • Guides

        How-to guides and tutorial

    • Company
      • Blog

        The latest from Liveblocks

      • Customers

        The teams Liveblocks empowers

      • Changelog

        Weekly product updates

      • Security

        Our approach to security

      • About

        The story and team behind Liveblocks

  • Docs
  • Pricing
  • Ready-made features
    • AI Copilots
    • Comments
    • Multiplayer Editing
    • Notifications
    • Presence
    Platform
    • Monitoring Dashboard
    • Realtime Infrastructure
    Solutions
    • People platforms
    • Sales tools
    • Startups
    Use cases
    • Multiplayer forms
    • Multiplayer text editor
    • Multiplayer creative tools
    • Multiplayer whiteboard
    • Comments
    • Sharing and permissions
    • Document browsing
  • Resources
    • Documentation
    • Examples
    • React components
    • DevTools
    • Next.js Starter Kit
    • Tutorial
    • Guides
    • Release notes
    Technologies
    • Next.js
    • React
    • JavaScript
    • Redux
    • Zustand
    • Yjs
    • Tiptap
    • BlockNote
    • Slate
    • Lexical
    • Quill
    • Monaco
    • CodeMirror
  • Company
    • Pricing
    • Blog
    • Customers
    • Changelog
    • About
    • Contact us
    • Careers
    • Terms of service
    • Privacy policy
    • DPA
    • Security
    • Trust center
    • Subprocessors
  • HomepageSystem status
    • Github
    • Discord
    • X
    • LinkedIn
    • YouTube
    © 2025 Liveblocks Inc.
Blog/Engineering

Build collaborative text experiences with Liveblocks Yjs

For teams who want to build a collaborative text editing experince, like Google Docs, Liveblocks Yjs is a fully managed, highly scalable realtime data store for Yjs documents.

on September 5th, 2023
Build collaborative text experiences with Liveblocks Yjs
September 5th, 2023·4 min read
Share article

Liveblocks provides two powerful serverless data stores for real-time collaboration: Liveblocks Storage for multiplayer creative tools and Liveblocks Yjs for collaborative text editing. Liveblocks Yjs is a fully managed, highly scalable data store that lets you build Google Docs-style editors in days instead of months. Check out our open-source demo built with Liveblocks Yjs below.

Loading
Loading

What is Yjs you may ask? It’s an open-source CRDT framework created by Kevin Jahns that has grown to be the preferred way for developers to build collaborative rich text editors. It comes with powerful features such as multiplayer undo/redo, lazy loading subdocuments, and offline support. And thanks to its incredible community, Yjs already has integrations with the most popular open-source text and code editor frameworks out there: Lexical, Tiptap, Slate, Quill, CodeMirror, Monaco, and more.

The challenge though is that the decentralized nature of Yjs makes it difficult to scale for production applications. Since all updates get stored, Yjs documents tend to get big really fast. Plus, the raw Yjs data requires some heavy engineering lifting to be dealt with.

That’s why we’ve created Liveblocks Yjs, the world’s most advanced platform for building, hosting, and scaling Yjs applications. No configuration, no maintenance required.

Supercharged Yjs developer experience

It’s fair to say that developer experience is close to our heart so it was important to us that Yjs integrated seamlessly into the Liveblocks ecosystem you’re already used to: dashboard, DevTools, webhooks, REST API, and more.

A centralized hub for Yjs documents

Enable anyone on your team to view, inspect, and manage, stored Yjs documents from the Liveblocks dashboard.

Yjs documents in the Liveblocks dashboard

Yjs triggered webhook events

Webhook events are triggered as users edit Yjs documents, enabling you to automatically perform custom actions in your back end, such as sending notifications, saving your data to a database, or indexing for search.

Yjs webhook events - YDocUpdatedEvent

Interact with Yjs documents via REST API

The Liveblocks REST API enables you to retrieve and update Yjs documents. Ideal for syncing data with your own system.

https://api.liveblocks.io/v2/rooms/{roomId}/ydochttps://api.liveblocks.io/v2/rooms/{roomId}/ydoc-binary

Hosted on a robust and highly scalable WebSocket infrastructure

Liveblocks Yjs runs on a WebSocket infrastruture where Yjs documents are stored in edge regions close to your users, reducing latency and improving end-user performance while enabling you to scale effortlessly. Liveblocks also manages awareness and WebSocket connections automatically, so you don’t have to.

Liveblocks WebSocket infrastructure

Getting started

Today, all users can get started with Liveblocks Yjs by using @liveblocks/yjs, our Yjs provider.

$npm i @liveblocks/yjs

This is how to set up your Yjs provider in JavaScript—attach this to your chosen editor to enable multiplayer.

import { createClient } from "@liveblocks/client";import LiveblocksProvider from "@liveblocks/yjs";import * as Y from "yjs";
const client = createClient({ publicApiKey: "sk_prod_xxxxxxxxxxxxxxxxxxxxxxxx",});
// Get this with `useRoom` in Reactconst room = client.enter("your-room-id", { initialPresence: {} });const doc = new Y.Doc();
const provider = new LiveblocksProvider(room, doc);

Start with a guide

We recommend you start with a guide. We’ve written specific guides for each popular text and code editor.

  • Get started with a collaborative text editor
  • Get started with a collaborative code editor

We also have some more advanced Yjs guides focused around building more features into your app.

Try our examples

Along with our guides, we now have open-source examples for each editor, including the live demo posted in this article.

  • Text editor examples
  • Code editor examples

You can also try the Liveblocks Starter Kit for Next.js which now includes a collaborative text editor powered by Liveblocks Yjs.

Moving forward

We wouldn’t be here without the awesome work from Kevin Jahns and the Yjs community. Liveblocks is now a sponsor, and we’ll continue to invest in Yjs, furthering our aim of connecting people together, and building a more collaborative web.

CollaborationText editingStorage

Ready to get started?

Join thousands of companies using Liveblocks ready‑made collaborative features to drive growth in their products.

Book a demo

Related blog posts

  • Why we built our AI agents on WebSockets instead of HTTP

    Why we built our AI agents on WebSockets instead of HTTP

    Picture of Jonathan Rowny
    Picture of Nimesh Nayaju
    September 29th
    Engineering
  • What's the best vector database for building AI products?

    What's the best vector database for building AI products?

    Picture of Jonathan Rowny
    September 15th
    Engineering
  • We’ve open-sourced our customizable React emoji picker

    We’ve open-sourced our customizable React emoji picker

    Picture of Chris Nicholas
    Picture of Marc Bouchenoire
    Picture of Pierre Le Vaillant
    March 20th
    Engineering