Back to Rivet

Collaborative Document

examples/collaborative-document-vercel/README.md

2.2.11.8 KB
Original Source

Note: This is the Vercel-optimized version of the collaborative-document example. It uses the hono/vercel adapter and is configured for Vercel deployment.

Collaborative Document

A shared text editor that uses Rivet Actors with Yjs for real-time CRDT sync and presence.

Getting Started

sh
git clone https://github.com/rivet-dev/rivet.git
cd rivet/examples/collaborative-document
npm install
npm run dev

Features

  • Coordinator pattern: One documentList actor per workspace indexes document actors
  • CRDT synchronization: Document actors broadcast Yjs updates to every collaborator
  • Presence and cursors: Awareness updates flow through actor events for live cursors
  • Durable persistence: Yjs snapshots are stored in actor KV for crash recovery

Implementation

The coordinator creates document actors and tracks IDs, while each document actor stores Yjs state in KV storage and broadcasts updates.

Resources

Read more about coordinator actors, events, actions, and KV storage.

License

MIT