Co-authored by

collaboration
package designed to provide real-time collaborative features to your apps. By default, we use Liveblocks as our collaboration engine. To showcase what you can do with this package, we’ve built a simple collaborative experience in the app
application, featuring an avatar stack and live cursors.
Collaboration is enabled by the existence of the
LIVEBLOCKS_SECRET
environment variable.How it works
Liveblocks relies on the concept of rooms, digital spaces where people collaborate. To set this up, you need to authenticate your users, and add the correct providers, however JTBDOS has already integrated this, meaning you can start building your collaborative application immediately. We’ve also wired up two key props for the Liveblocks provider,resolveUsers
and resolveMentionSuggestions
, which are used to resolve the users and mention suggestions respectively.
Usage
Liveblocks provides a number of hooks making it easy to add real-time presence and document storage to your app. For example,useOthers
returns which users are currently connected, helpful for building avatars stacks and multiplayer cursors.
toolbar-avatars.tsx
Multiplayer documents
You can take your collaborative app a step further, and set up multiplayer document state withuseStorage
and useMutation
. This is ideal for creating custom experiences, such as a a multiplayer drawing panel, spreadsheet, or just a simple shared input and that anyone can edit.
collaborative-input.tsx
Commenting
Liveblocks also provides ready-made customizable components for adding collaboration, such asThread
and Composer
.
comments.tsx
Collaborative editing
To add a rich-text editor with full collaborative editing and floating comments, you can set up a Tiptap or Lexical editor in a few lines of code.collaborative-editor.tsx
Notifications
Liveblocks also provides notification components, meaning you can send in-app notifications to users that are tagged in comments, are mentioned in the text editor, or for any custom purpose.notifications.tsx
Infrastructure
Liveblocks not only provides these features, but it also has:- Browser DevTools to help you build your app.
- REST APIs for sever-side changes.
- Node.js SDK for using the REST APIs with TypeScript.
- Webhooks for triggering user-driven events.
- Dashboard to help with bug spotting and analytics.