Examples
Run Collaboration SDK examples by capability and open each example's guide, Server entry point, and Web entry point.
All examples are located in the univer-collaboration-examples repository. Each example follows the same minimal web/main.ts + server/main.ts structure and runs independently. Complete Quick Start first, then select the example that matches the current integration task.
| Example | Main concept | Command |
|---|---|---|
| Quick Start | Core collaboration path | pnpm example:quick-start |
| Database Adapter | Built-in and custom adapters | pnpm example:database-adapter |
| Permissions | Identity and authorization | pnpm example:permissions |
| History | Derived version history | pnpm example:history |
| Comments | Independent comments | pnpm example:comments |
| Worktree | Isolated editing and merge | pnpm example:worktree |
| File Service | File storage | pnpm example:file-service |
| Exchange | Office file exchange | pnpm example:exchange |
| All Unit | Every capability together | pnpm example:all-unit |
| Multi-node | Horizontal scaling | pnpm example:multi-node |
Quick start
Assemble Collaboration Client, Transport, Endpoint, Service, and Memory Adapter. Use two browsers to verify HTTP loading, WebSocket sessions, the Room, ACK, and broadcast for the same Sheet.
pnpm example:quick-startOpen http://127.0.0.1:3010/?unit=quick-start-sheet.
Database adapter
Begin with the built-in SQLite Adapter, then replace it with the PostgreSQL Adapter or an Adapter of your own.
pnpm example:database-adapterOpen http://127.0.0.1:3010/?unit=persistent-sheet.
Permissions
Sign in as Bob (editor), Casey (viewer), or Dana (no document access) to compare what each user can read or change. Alice is the document creator. The server checks reads, room joins, and changeset submissions.
pnpm example:permissionsOpen http://127.0.0.1:3010.
History
Add History Service, a separate Adapter, the History Endpoint, and the browser history entry, all outside Core. The Unit creation and changeset commit Events build History as a derived index that can be reconstructed.
pnpm example:historyOpen http://127.0.0.1:3010/?unit=history-sheet, edit the Sheet, and select History at the top of the page.
Comments
Add Thread Comment Service, a separate Adapter, the Comment Endpoint, and the frontend comment entry. The Comment Endpoint reuses the sessions and Unit Rooms of the main collaboration Endpoint.
pnpm example:commentsOpen http://127.0.0.1:3010/?unit=comments-sheet, select a cell, and use the comment entry.
Worktree
Follow the full lifecycle: an isolated draft, Ready, Reopen, and per-Unit Merge. Switch between trunk and draft to observe how Agent changes remain isolated until the merge.
pnpm example:worktreeOpen http://127.0.0.1:3010/?unit=worktree-sheet&worktree=demo-worktree.
File service
Connect the File Service and File Endpoint. Images inserted into the Sheet are uploaded to the server, and the Unit data records only the file ID.
pnpm example:file-serviceOpen http://127.0.0.1:3010/?unit=file-service-sheet and insert an image through Insert → Image → Float Image.
Exchange
Assemble the Exchange Service and Exchange Endpoint for server-side Sheet import and export, task polling, and export at a confirmed revision.
pnpm example:exchangeOpen http://127.0.0.1:3010/?unit=exchange-sheet. Import and export through the Import / Export toolbar above the editor.
All Unit
Combine all six Unit types, files, import and export, embedded attachments, comments, history, and print in a single application.
pnpm example:all-unitOpen http://127.0.0.1:3010 and switch Units in the sidebar.
Multi-node
Run two collaboration nodes behind Nginx. Redis relays realtime updates between the nodes and shares session tickets, so any node can serve any request. The example also requires Docker Compose and a License that covers two nodes.
pnpm example:multi-nodeOpen http://127.0.0.1:3010/ and select New Sheet to create a file. Copy the full URL into another tab to verify collaborative editing of the same document. Then create several more files and observe how they are distributed across the nodes.
Examples are not production applications
Fixed users, teaching authorization, Memory Adapters, local secrets, and in-memory task stores exist only for instruction. Identity, authorization, persistence, secrets, files, deployment, and product interaction remain the responsibility of the application.
How is this guide?