@loro-dev/flock-sqlite
SQLite-backed implementation of the Flock CRDT surface. This package mirrors the TypeScript bindings while persisting state through unisqlite and stays wire-compatible with the MoonBit-backed bindings.
import { Flock } from "@loro-dev/flock-sqlite";
const flock = await Flock.open({ path: "flock.db" });
await flock.put(["doc", 1], { title: "hello" });
const bundle = await flock.exportJson();
const replica = await Flock.fromJson({ path: "replica.db", bundle });
console.log(await replica.get(["doc", 1]));
await flock.close();
await replica.close();
See prd/003-flock-sqlite.md for the intended semantics (memcomparable keys, export/import, digest, and cross-platform SQLite adapters).
Runtime peers
This adapter relies on unisqlite platform drivers. Install the matching peers for your environment:
- Node:
better-sqlite3
- Browser:
broadcast-channel and @sqlite.org/sqlite-wasm (when loading WASM from npm/CDN)
- Cloudflare Workers: no extra peers required