@itzelyot/nexus-crdt-core
v0.1.1
Published
Nexus — leaderless CRDT state synchronization (LWW-Register, OR-Set, RGA text) with a TLV binary op log and Merkle history
Maintainers
Readme
@nexus-crdt/core
Nexus — leaderless CRDT state synchronization for Node.js. Zero runtime
dependencies. Dual ESM/CJS build. Works with Buffer, TypedArray and
SharedArrayBuffer views, and inside worker_threads.
npm install @nexus-crdt/coreimport { NexusMap } from "@nexus-crdt/core"; // CJS: require() works too
const map = new NexusMap({ actorId: "server-1" });
map.set("title", "Hello");
map.orSet("tags").add("crdt");
map.text("doc").insert(0, "hello");
map.merge(new Uint8Array(remoteFrame)); // converges — simultaneous writes never throw
map.encode(); // canonical TLV frame
map.merkleRoot(); // SHA-256 Merkle digest of the op history
NexusMap.diff(aBytes, bBytes); // structural diffError handling: every failure is a NexusError with a stable code
(NEXUS_OOM, NEXUS_PARSE, ...). Concurrent conflicts are not errors:
higher Lamport wins, ties fall to the larger ActorID.
See the repository root and spec/PROTOCOL.md for the cross-language wire
protocol (byte-compatible with the Python and PHP ports).
Development
npm run build # dual ESM + CJS
npx vitest run # unit + property + cross-language vector tests
npm run bench # benny + normalized JSON for CI regression checks