English | 简体中文
This repository contains only runnable examples for the Univer Collaboration SDK. The public documentation is maintained on docs.univer.ai.
- Follow the documentation site's Quick Start and use two browsers to verify the HTTP, WebSocket, and OT path.
- Choose an example below for the capability you want to explore, then compare its minimal frontend and backend source.
- Use the Collaboration documentation for architecture, middleware, identity, persistence, and production guidance.
All examples use the same minimal web/main.ts + server/main.ts structure and can run
independently. Start with quick-start to establish the main
collaboration path, then choose another example for the capability you want to explore.
| Example | What it demonstrates |
|---|---|
quick-start |
Minimal real-time Sheet collaboration path |
database-adapter |
SQLite persistence and restart recovery |
permissions |
Trusted identity and server-side permission boundaries |
object-permissions |
Worksheet and range protection with an application-owned ACL |
history |
Version history service and browser entry |
comments |
Thread Comment service and frontend entry |
worktree |
Complete draft, ready, reopen, and merge lifecycle |
file-service |
File Service and File Endpoint for images and attachments; Unit data records only the file ID |
exchange |
Server-side Sheet import/export with exchange-node |
all-unit |
Six Unit types with files, import/export, embedded attachments, comments, history, and print in one application |
multi-node |
File creation and listing across two collaboration nodes with Redis cross-node delivery and Nginx consistent hashing by unitID; needs a multi-node License |
Prepare Node.js 24 or later and pnpm:
pnpm install
pnpm example:quick-startThe other examples use the same command form:
pnpm example:database-adapter
pnpm example:permissions
pnpm example:object-permissions
pnpm example:history
pnpm example:comments
pnpm example:worktree
pnpm example:file-service
pnpm example:exchange
pnpm example:all-unit
pnpm example:multi-nodeIf you have a License, set two variables in the terminal before running the commands above:
export UNIVER_LICENSE="$(cat license.txt)"
export UNIVER_LICENSE_KEY="$(cat licenseKey.txt)"The build writes UNIVER_LICENSE into the browser bundle; at startup the server passes UNIVER_LICENSE and
UNIVER_LICENSE_KEY together to UniverCollabService. With neither set, the examples run on the free tier: one node
with 3 collaborative editing connections. multi-node needs a License that covers multiple nodes.
See License.
The examples cover only teaching and copyable assembly. They do not include file spaces
or a complete office suite. file-service, exchange, and all-unit keep uploaded files on the
local disk rather than in a production file service; file-service
explains the routes the Univer client calls and what to change for production.
quick-start uses the Memory Adapter to keep setup minimal. The other single-node examples store
collaboration data in their own .data/collaboration.sqlite file so state survives server restarts.
multi-node requires Docker Compose and builds inside its containers. Both nodes share one PostgreSQL
database whose data lives in a Docker volume.
Fixed users, demo authorization, and local secrets are for teaching only and are not production configuration. Before integrating in production, read Identity and authorization, Middleware and Events, and Database Adapters.