Collaboration
next-forge is multiplayer out of the box.
next-forge maintains a 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.
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 next-forge 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.
Multiplayer documents
You can take your collaborative app a step further, and set up multiplayer document state with useStorage
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.
Commenting
Liveblocks also provides ready-made customizable components for adding collaboration, such as Thread
and Composer
.
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.
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.
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.
Learn more by checking out the Liveblocks documentation, examples, and interactive tutorial.