articollab
v0.5.0
Published
Server-authoritative collaborative collections powered by articulated.
Maintainers
Readme
Articollab
Typed, server-authoritative collaborative collections for TypeScript, powered by articulated.
Clients edit optimistically; the server orders commits and clients replay unacknowledged work. Not a CRDT. Includes Value, List and Unicode Text, transactions, server policy, wire decoding, checkpoints and catch-up. Your application supplies transport, storage and authentication.
Install
Install from npm. Use an ESM project ("type": "module"); the Node.js examples require Node 24+.
pnpm add articollabQuick start
A single client and server, connected in memory:
import { createClient, createServer, defineDocument, value } from "articollab";
const Counter = defineDocument({ count: value(0) });
const server = createServer(Counter);
const doc = createClient(Counter, {
clientId: server.openClient(),
onBatch(batch) {
doc.receive(server.receive(batch).commit);
},
});
doc.state.count.value = 1;
console.log(doc.state.count.value); // 1The server opens a writer session before its first batch. Disconnecting preserves that session; server.closeClient(id) permanently retires it. This example submits and acknowledges each batch synchronously. For multiple clients, deliver commits to every client in server order; see the walkthroughs below.
Documentation
License
MIT.
