Get started with a Tiptap text editor using Liveblocks Storage and Next.js
Liveblocks is a realtime collaboration infrastructure for building performant
collaborative experiences. Follow the following steps to start adding
collaboration to your Next.js application using
@liveblocks/react-tiptap with
collaborationMode: "liveblocks".
This stores text as LiveText
backed by Liveblocks Storage instead of using a Yjs document.
This guide uses Liveblocks Storage. For the default Yjs-backed setup (including experimental offline support and AI), see the standard Tiptap Next.js quickstart.
Quickstart
Install Liveblocks and Tiptap
Every Liveblocks package should use the same version.
TerminalInitialize the
liveblocks.config.tsfileWe can use this file later to define types for our application.
TerminalCreate a Liveblocks room
Liveblocks uses the concept of rooms, separate virtual spaces where people collaborate, and to create a realtime experience, multiple users must be connected to the same room. When using Next.js’
/approuter, we recommend creating your room in aRoom.tsxfile in the same directory as your current route.In Storage mode, documents are created under
root._tiptap_docswhen the editor first connects, so you can leaveinitialStorageempty.Set up a Liveblocks client with
LiveblocksProvider, join a room withRoomProvider, and useClientSideSuspenseto add a loading spinner to your app.app/Room.tsxAdd the Liveblocks room to your page
After creating your room file, import it into your
page.tsxfile and place your editor inside it.app/page.tsxSet up the collaborative Tiptap editor
Create a Tiptap editor in
Editor.tsx. PasscollaborationMode: "liveblocks"touseLiveblocksExtensionso the document syncs through Storage. Set afieldname and optionalinitialContentfor the first visit.app/Editor.tsxRender threads
Comments work the same as in Yjs mode. Create a
Threads.tsxfile that usesFloatingThreadsandAnchoredThreads.app/Threads.tsxStyle your editor
Import Liveblocks styles in your layout, and add basic editor CSS:
app/layout.tsxNext: authenticate and add your users
Text Editor is set up and working now, but each user is anonymous—the next step is to authenticate each user as they connect, and attach their name, color, and avatar, to their cursors and mentions.
Add your users to Text Editor
What to read next
Congratulations! You now have set up a Storage-backed collaborative Tiptap editor inside your Next.js application.