What You’ll Build
- A rich text editor where multiple users can type simultaneously
- Conflict-free collaborative editing via CRDTs
- Persistent document state (survives page refreshes)
- User cursors and presence indicators
Prerequisites
- A CollabKit server running with a room and users created
@collab-kit/clientinstalled
Step 1: Install Dependencies
Step 2: Set Up CollabKit
Yjs writes require an editor session. A viewer can load and receive document updates, but outbound Yjs changes are blocked.
Step 3: Create the Yjs Document and Provider
Step 4: Initialize TipTap
Step 5: Add a Loading State
Show a loading indicator until the document syncs:Step 6: Add User Presence (Optional)
Show cursor positions of other users alongside the editor:Step 7: Clean Up
Multiple Documents Per Room
You can have multiple collaborative documents in the same room by using differentdocumentId values:
Next Steps
- Add cursor tracking alongside the editor
- Use stores to save editor metadata (last editor, word count)
- Add comments anchored to text selections