Liveblocks best practices

From code-with-antonio/browser-automation-app · View interactive version

Liveblocks best practices is an AI agent skill from the GitHub repository code-with-antonio/browser-automation-app. Use this skill when building, debugging, or answering questions about Liveblocks. Liveblocks gives you the building blocks and infrastructure to enable people and AI to work together inside your app, powering realtime collaboration. Liveblocks features include collaboration, rooms, organizations, wo

How to use this skill

Skill file

Liveblocks best practices

When to use this skill

Use this skill when implementing features using any Liveblocks packages, for

example CODE0

or CODE0. This

could be related to features like realtime multiplayer, commenting,

notifications, cursors, avatar stacks, AI, and more. This also includes

technologies like Liveblocks Storage, Yjs, Tiptap, BlockNote, Lexical, React

Flow, tldraw, and more.

Quick reference

A number of reference files are available in the references/ directory. You

must read the list below, and load relevant files as needed. For example,

add-user-information is available in the references/add-user-information.md

file.

References

name, avatar, color, and more. Users will no longer be anonymous. Useful for

displaying user info in comments, comments mention suggestions, notifications,

cursors, avatar stacks.

a human inside your Liveblocks application.

RAG, knowledge, custom components, tool calling, custom models. Different to

AI as a collaborator, as it is NOT workflow based.

instead of passing a string to authEndpoint. Useful for passing custom

headers to your back end, and for preventing automatic reconnection when the

token is invalid.

users with their ID and info, best for very simple permissions.

with their ID and info, best for complex permissions.

workspaces/tenants and compartmentalize resources, such as rooms,

notifications, comment threads, and more. You can filter by organization when

listing rooms and more.

use cases only).

custom conflict-resolved multiplayer apps, like Figma, Pitch, Spline. Helpful

for one-off realtime features too, like simple properties in a document.

floating next to your selection, in Tiptap and Lexical.

applications, setting permissions, organization, metadata.

threads, and their different parts.

Continuous Integration (CI) and End-to-End (E2E) testing. Connect to your app

not online.

connected users with DevTools extensions for Chrome, Firefox, Edge.

button values, tooltip text, error text, more. Also helpful for setting other

languages.

useMutation by configuring the react-hooks/exhaustive-deps ESLint rule.

permissions, authentication, changed room IDs.

pre-built components.

users have poor network conditions.

where you cannot navigate the page to log out.

multiplayer diagrams with cursors and more.

page. Optionally use Storage to hold their field IDs.

quicker load time.

overriding Liveblocks CSS variables.

using useOtherConnectionIds, useOthersMapped, useOther, and shallow to

update components only when necessary.

using useStorage selectors and shallow.

changes.

merge components from your design system into Liveblocks UI.

right of the screen, this is how to remove it.

error fallbacks.

structure your app with loading skeletons and spinners.

they have unread comments. These comments are sent via webhooks, and are

triggered when a user is mentioned, or has participated in a thread.

rate, appearing more smooth. Using this option, updates can be received more

frequently.

hooks. React suspense uses ErrorBoundary and ClientSideSuspense

components. Regular hooks use { error, isLoading } values.

initial content, unsaved changes, more.

inbox, even those unrelated to commenting.

available. Presence, others, user info, storage, metadata, room info,

notifications activities, can all be automatically typed.

incorporate document titles in the URL.

timestamps, durations, file sizes.

getYjsProviderForRoom. NOT relevant if you're using Tiptap, BlockNote, or

Lexical.

Note

Some files link to markdown files in the Liveblocks docs, for example:

https://liveblocks.io/docs/concepts.md

When linking users to these pages, remove .md from the link, so they can view

the full content:

https://liveblocks.io/docs/concepts

Liveblocks packages

Always check if we provide a package for your technology. For example, if you're

using React Flow, you should use @liveblocks/react-flow.

Vue, Svelte, vanilla JS.

@liveblocks/react for data and hooks.

React.

Node.js. Also works with Tiptap and BlockNote.

Discord, etc.) chat bots.

If a technology is not listed here

If the users want to set up a new technology, first check the following

resources to see if a package exists:

Learn more

Learn more in Liveblocks docs.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.