AbsoluteJS

@absolutejs/sync-automerge

@absolutejs/sync-automergev0.0.4betaData & Sync

Automerge-backed collaborative-text CRDT adapter for @absolutejs/sync

#Installation

BASH
bun add @absolutejs/sync-automerge

#Capabilities

Overview

An Automerge-backed collaborative-text CRDT for @absolutejs/sync, behind the same CrdtText / TextCrdtAdapter contract as the core's zero-dependency rgaText and @absolutejs/sync-yjs.

@absolutejs/sync/crdt ships a first-party RGA text CRDT that's great for offline-merge and moderate collaboration. Automerge is a mature, battle-tested CRDT library; this adapter lets you swap it in without touching your call sites.

Use

The serialized state is a base64 string of an Automerge document — JSON-safe for the sync engine's change feed. merge is commutative/associative/idempotent.

The contract

Implements TextCrdtAdapter from @absolutejs/sync/crdt: create, merge, empty, textOf. The replica argument is accepted for contract compatibility; Automerge manages actor identity internally.

Outcomes

What you can build

Build on the supported package contract

Use @absolutejs/sync-automerge through its supported public entry points.

Hardening checklist

Production guidance

Make every external boundary explicitPin the deployed @absolutejs/sync-automerge version, replace example or memory-backed dependencies with durable implementations, bound external calls, protect credentials, and emit enough evidence to retry or recover safely.

Follow in order

Troubleshooting path

1
Trace from the first failed boundary
Reproduce the smallest canonical @absolutejs/sync-automerge example, confirm the supported entry point and version in the API explorer, then inspect the first boundary that did not produce its documented result.

#Use

Partial snippet

Working example for Use.

TS
import { automergeText } from '@absolutejs/sync-automerge';
// ...instead of: import { rgaText } from '@absolutejs/sync/crdt';

// Server — declare the CRDT field with this backend
engine.registerCrdt('doc', { state: automergeText });

// Client — same hook, just pass the backend's factory
const doc = useCollaborativeText({
	collection: 'doc',
	field: 'state',
	id: 'shared',
	url,
	create: (replica) => createAutomergeText(replica)
});

#Public entry points

Supported entry points declared by this package manifest.

Package entry point declared in package.json.

@absolutejs/sync-automerge@absolutejs/sync-automerge/manifest@absolutejs/sync-automerge/manifest.json

#Package commands

Scripts declared by this package manifest.

bun run buildrm -rf dist && bun build src/index.ts src/manifest.ts --outdir dist --sourcemap --target=bun --external @absolutejs/sync --external @automerge/automerge && tsc --project tsconfig.build.json && absolute-manifest emit
bun run formatprettier --write "./**/*.{ts,json,md}"
bun run testbun test
bun run typechecktsc --noEmit

#API reference

Search the declarations exported by the current package type files. Expand a symbol to inspect its source-backed signature.

2 symbols
createAutomergeTextvaluePermalinkSource

Create a live Automerge-backed collaborative-text doc for replica.

TS
const createAutomergeText: (replica: string, initial?: string) => CrdtText<string>;
Exported from @absolutejs/sync-automerge