# @stepwisehq/prosemirror-collab-commit

> Commit-based collab plugin for ProseMirror

Latest version **1.0.5** (published 2025-09-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install @stepwisehq/prosemirror-collab-commit
pnpm add @stepwisehq/prosemirror-collab-commit
yarn add @stepwisehq/prosemirror-collab-commit
bun add @stepwisehq/prosemirror-collab-commit
```

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2025-09-03 |
| First published | 2023-07-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 28.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | ProTip |
| Maintainers | protip |
| Keywords | prosemirror |

## Links

- npm: https://www.npmjs.com/package/@stepwisehq/prosemirror-collab-commit
- Homepage: https://github.com/stepwisehq/prosemirror-collab-commit
- npm.io page: https://npm.io/package/@stepwisehq/prosemirror-collab-commit

## Dependencies (1)

- [prosemirror-state](https://npm.io/package/prosemirror-state.md) ^1.0.0

## Recent versions

- 1.0.5 (latest) — 2025-09-03
- 1.0.4 — 2025-08-25
- 1.0.3 — 2023-08-02
- 1.0.1 — 2023-07-17
- 1.0.0 — 2023-07-16

## README

prosemirror-collab-commit
=========================

> [!NOTE]
> This project is *not* dead. ProseMirror's core packages change extremely infrequently; including bug fixes.

Commit-based collaborative editing plugin for ProseMirror.

This solves two key problems with `prosemirror-collab` through server-side
rebasing without the use of CRDTs:

1. **Throughput**: 200 active clients per 1s of commit delay is feasible
   depending on backend implementation and edit characteristics.
2. **Fairness**: Users with high latencies will not have their edits blocked by
   users with low latencies. This will **greatly smooth the collab experience** on
   documents with high levels of concurrent edits.

## How it works

The performance issues with `prosemirror-collab` and how this plugin solves them
are written about in [ProseMirror Collab Performance](https://stepwisehq.com/blog/2023-07-25-prosemirror-collab-performance/).

## Usage

Abridged usage examples that should be familar to those who have used `prosemirror-collab`.

As with `prosemirror-collab` the actual backend implementation is left to the
developer. `TODO: Implement` indicates code the implementor must write.

**Client Send Commit**

```typescript
import { collab, sendableCommit } from "@stepwisehq/prosemirror-collab-commit/collab-commit"

const state = EditorState.create({schema}, {plugins: [collab()]})

//Some edits later...

const commit = sendableCommit(state)
await sendCommitToServer(commit.toJSON()) // TODO: Implement
```

**Client Receive Commit**

```typescript
import { receiveCommitTransaction } from "@stepwisehq/prosemirror-collab-commit/collab-commit"

//...

const commitJson = await fetchNextCommitFromServer() // TODO: Implement
const commit = Commit.FromJSON(state.schema, commitJson)
const tr = receiveCommitTransaction(state, commit)
state = state.apply(tr)
```


**Authority Map Commit**

```typescript
import { applyCommitJSON } from "@stepwisehq/prosemirror-collab-commit/apply-commit"

const newCommitJson = await getCommitsFromClient() // TODO: Implement

const version = await getDocumentVersion() // TODO: Implement
const doc = await getDocument() // TODO: Implement
const newCommits = await getDocumentCommitsSince(commitJson.version) // TODO: Implement
const schemaSpec = await getSchemaSpec() // TODO: Implement

const schema = new Schema(schemaSpec)

const {docJson, commitJson} = applyCommitJSON(version, schema, doc, newCommits, newCommitJson)

await saveDocument(docJson) // TODO: Implement
await broadcastCommit(commitJson) // TODO: Implement
```

---
_Source: https://npm.io/package/@stepwisehq/prosemirror-collab-commit · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
