# Package Overview

> Understand the public Collaboration SDK packages for Core, History, Thread Comment, Worktree, and Office Exchange.

- Human documentation: [https://office.univer.ai/collaboration/packages](https://office.univer.ai/collaboration/packages)

- Agent Markdown: [https://office.univer.ai/collaboration/packages.md](https://office.univer.ai/collaboration/packages.md)

- Language: `en`

- Source file: `content/docs/collaboration/packages.mdx`

- Upstream source: [https://github.com/dream-num/office.univer.ai/blob/main/content/docs/collaboration/packages.mdx](https://github.com/dream-num/office.univer.ai/blob/main/content/docs/collaboration/packages.mdx)

---

This page is a package selection map for the Collaboration SDK. Assemble Core Collaboration first,
then add extension modules required by the product. You do not need to install every package.

## Core Collaboration

Core Collaboration provides the main path for browser collaboration, server protocol handling, OT,
revisions, and persistence.

| Runtime  | Package                                                                                                                    | Primary responsibility                                                  |
| -------- | -------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| Browser  | [`@univerjs-pro/collaboration`](https://www.npmjs.com/package/@univerjs-pro/collaboration)                                 | Registers foundational browser collaboration capabilities               |
| Browser  | [`@univerjs-pro/collaboration-client`](https://www.npmjs.com/package/@univerjs-pro/collaboration-client)                   | Loads Units, submits changesets, and maintains realtime synchronization |
| Browser  | [`@univerjs-pro/collaboration-client-ui`](https://www.npmjs.com/package/@univerjs-pro/collaboration-client-ui)             | Provides collaboration status UI and styles                             |
| Server   | [`@univerjs-pro/collaboration-transport-node`](https://www.npmjs.com/package/@univerjs-pro/collaboration-transport-node)   | Receives Node.js HTTP and WebSocket traffic                             |
| Server   | [`@univerjs-pro/collaboration-endpoint`](https://www.npmjs.com/package/@univerjs-pro/collaboration-endpoint)               | Implements the Client protocol, Sessions, Rooms, and Presence           |
| Server   | [`@univerjs-pro/collaboration-service`](https://www.npmjs.com/package/@univerjs-pro/collaboration-service)                 | Manages Units, OT, revisions, and core Service APIs                     |
| Database | [`@univerjs-pro/collaboration-database-memory`](https://www.npmjs.com/package/@univerjs-pro/collaboration-database-memory) | In-process storage for tests, examples, and temporary development       |
| Database | [`@univerjs-pro/collaboration-database-sqlite`](https://www.npmjs.com/package/@univerjs-pro/collaboration-database-sqlite) | SQLite persistence for development, testing, local, and small-scale use |

A Core Server needs Transport, Endpoint, Service, and one Database Adapter. Memory and SQLite
implement the same Adapter contract; applications normally select one.

## History

History builds a version-history index from Core Unit creation and changeset commit Events.

| Runtime  | Package                                                                                                                                    | Primary responsibility                               |
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------- |
| Browser  | Reuses Core Client/UI                                                                                                                      | Displays and reads history entries                   |
| Server   | [`@univerjs-pro/collaboration-history-service`](https://www.npmjs.com/package/@univerjs-pro/collaboration-history-service)                 | Builds and queries the history index                 |
| Server   | [`@univerjs-pro/collaboration-history-endpoint`](https://www.npmjs.com/package/@univerjs-pro/collaboration-history-endpoint)               | Provides History protocol capabilities to the Client |
| Database | [`@univerjs-pro/collaboration-history-database-sqlite`](https://www.npmjs.com/package/@univerjs-pro/collaboration-history-database-sqlite) | Stores the derived History index                     |

History data is a rebuildable derived index. Core changesets remain authoritative for Unit content.

## Thread Comment

Thread Comment manages comment bodies, replies, and solved state for Sheets and Docs.

| Runtime  | Package                                                                                                                                    | Primary responsibility                                                 |
| -------- | ------------------------------------------------------------------------------------------------------------------------------------------ | ---------------------------------------------------------------------- |
| Browser  | Reuses Core Collaboration packages                                                                                                         | Uses Comment Client and UI capabilities                                |
| Server   | [`@univerjs-pro/collaboration-comment-service`](https://www.npmjs.com/package/@univerjs-pro/collaboration-comment-service)                 | Manages comment operations and the `commentCommitted` Event            |
| Server   | [`@univerjs-pro/collaboration-comment-endpoint`](https://www.npmjs.com/package/@univerjs-pro/collaboration-comment-endpoint)               | Provides the comment protocol and publishes updates through Unit Rooms |
| Database | [`@univerjs-pro/collaboration-comment-database-memory`](https://www.npmjs.com/package/@univerjs-pro/collaboration-comment-database-memory) | In-process comment storage                                             |
| Database | [`@univerjs-pro/collaboration-comment-database-sqlite`](https://www.npmjs.com/package/@univerjs-pro/collaboration-comment-database-sqlite) | SQLite comment persistence                                             |

The Comment Adapter stores comment data. Anchors that move with content remain part of Core
snapshots and changesets.

## Worktree

Worktree provides isolated drafts, status transitions, and per-Unit merge.

| Runtime  | Package                                                                                                                                      | Primary responsibility                                  |
| -------- | -------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------- |
| Browser  | [`@univerjs-pro/collaboration-worktree-client`](https://www.npmjs.com/package/@univerjs-pro/collaboration-worktree-client)                   | Connects Worktree draft, status, and merge capabilities |
| Server   | [`@univerjs-pro/collaboration-worktree-service`](https://www.npmjs.com/package/@univerjs-pro/collaboration-worktree-service)                 | Manages draft changesets, status, and merge             |
| Server   | [`@univerjs-pro/collaboration-worktree-endpoint`](https://www.npmjs.com/package/@univerjs-pro/collaboration-worktree-endpoint)               | Provides protocol capabilities to Worktree Client       |
| Database | [`@univerjs-pro/collaboration-worktree-database-memory`](https://www.npmjs.com/package/@univerjs-pro/collaboration-worktree-database-memory) | In-process Worktree storage                             |
| Database | [`@univerjs-pro/collaboration-worktree-database-sqlite`](https://www.npmjs.com/package/@univerjs-pro/collaboration-worktree-database-sqlite) | SQLite Worktree persistence                             |

Worktree Service eventually merges into the trunk through Core Service, so Middleware must be
configured for both Service boundaries.

## Office Exchange

Office Exchange is an application workflow combining file conversion with Collaboration Service.
It has no independent collaboration Database Adapter.

| Runtime | Package                                                                                                      | Primary responsibility                                   |
| ------- | ------------------------------------------------------------------------------------------------------------ | -------------------------------------------------------- |
| Browser | [`@univerjs-pro/exchange-client`](https://www.npmjs.com/package/@univerjs-pro/exchange-client)               | Provides foundational browser file-exchange capabilities |
| Browser | [`@univerjs-pro/sheets-exchange-client`](https://www.npmjs.com/package/@univerjs-pro/sheets-exchange-client) | Provides Sheet file import and export                    |
| Server  | [`@univerjs-pro/exchange-node`](https://www.npmjs.com/package/@univerjs-pro/exchange-node)                   | Converts Office files and Univer data in Node.js         |

For import, the application passes converted data to `createUnitFromSnapshot()`. For export, it
reads a confirmed Unit revision through Core Service. Files, tasks, and business APIs remain under
application control.

## Selection rules

1. Start with the Core packages from [Quick Start](https://office.univer.ai/collaboration/quick-start.md).
2. Select one Core Database Adapter from Memory, SQLite, or a custom implementation.
3. Install only the extension-module packages used by the product.
4. Create separate Adapters for each module even when they share one SQLite file.

See [Collaboration extension modules](https://office.univer.ai/collaboration/extensions.md) for module relationships and the
[examples index](https://office.univer.ai/collaboration/examples.md) for runnable assemblies.
