doc-sync
Define your document schema. Edit locally. Merge changes by stable token identity.
@barocss/doc-sync · TypeScript · Development workspace
doc-sync is a document CRDT with a synchronization client, a transport-independent server, and ProseMirror, Tiptap, Slate and Lexical bindings. The application provides the schema. The core works with document shapes rather than built-in paragraph or table names.
Start with a small document
import {Client, type Schema} from "@barocss/doc-sync";
const schema: Schema = {
root: "content",
marks: ["bold"],
nodes: {
content: {shape: "flow", children: ["paragraph"], default: "paragraph"},
paragraph: {shape: "text"},
},
};
const client = new Client({schema});
client.edit([{op: "insert", at: [0, 0], content: "Hello, shared document."}]);
console.log(client.model());Use the same Client with or without a transport →
Learn the contracts
- Schema shapes define text, inline nodes, flows, groups, and grids.
- Model operations connect an editor to stable CRDT operations, including block movement.
- Editor integration paths include ProseMirror, Slate, Lexical, and the custom demo editor.
- Change an open editor's schema explains selection restoration and pending changes.
- AI and bots has a separate path for document server connection, MCP editing, bot missions, and recovery.
- Client demo runs all four editors; the Codex walkthrough covers headless collaboration.
- Troubleshooting and operations and performance cover recovery and measurement limits.
- Collaboration intent defines deletion, formatting, insertion, and undo outcomes.
- State and wire contract describes ordering, validation, reconnect, and garbage collection.
Know the current limits
The ten packages export compiled JavaScript and declarations but remain private: true. They are not yet npm releases. The macOS MCP app has bounded restart and lease-expiry recovery with the demo server; production recovery, authorization, incompatible schema migration and long-term deployment validation remain open. Convergence does not guarantee every user's semantic intent.