A demonstration of collaborative rich text editing with Jazz, React, and ProseKit.
Original implementation by prosekit
Live version: https://richtext-prosekit.demo.jazz.tools
This example shows how to implement collaborative rich text editing using:
- Jazz for real-time synchronization
- CoRichText for collaborative rich text data structures
- ProseKit for the rich text editor UI
- React for the component framework
You can either
- Clone the jazz repository, and run the app within the monorepo.
- Or create a new Jazz project using this example as a template.
Create a new Jazz project, and use this example as a template.
npx create-jazz-app@latest richtext-prosekit-app --example richtext-prosekitGo to the new project directory.
cd richtext-prosekit-appCreate a .env file and add an API key (available for free from https://dashboard.jazz.tools)
VITE_JAZZ_API_KEY=<your key>
Run the dev server.
npm run devThis requires pnpm to be installed, see https://pnpm.io/installation.
Clone the jazz repository.
git clone https://github.com/garden-co/jazz.gitInstall and build dependencies.
pnpm i && npx turbo buildGo to the example directory.
cd jazz/examples/richtext-prosekit/Create a .env file and add an API key (available for free from https://dashboard.jazz.tools)
VITE_JAZZ_API_KEY=<your key>
Start the dev server.
pnpm devOpen http://localhost:5173 with your browser to see the result.
This example demonstrates two key functionalities:
- CoRichText - Jazz's collaborative rich text data structure
- Rich text integration - Using ProseKit with Jazz
src/schema.ts- Defines the data model, including thebiofield using CoRichTextsrc/Editor.tsx- Implements both plaintext and rich text editor viewsjazz-richtext-prosekit- Provides the plugin that connects Jazz to ProseKit
The example shows how to:
- Create and store CoRichText values
- Set up a plaintext editor with CoRichText
- Set up a ProseKit editor with a Jazz plugin
You can extend this example by:
- Adding formatting options to the rich text toolbar
- Adding multiple collaborative documents
- Building document history or versioning
By default, the app uses Jazz Cloud (wss://cloud.jazz.tools) - so cross-device use, invites and collaboration should just work.
You can also run a local sync server by runningnpx jazz-run sync, and setting the sync parameter ofJazzReactProvider in ./src/main.tsx to{ peer: "ws://localhost:4200" }.
To learn more about Jazz's collaborative text capabilities:
If you have feedback, let us know on Discord or open an issue or PR to fix something that seems wrong.