Framework-free web projects
Peerborne does not require a frontend framework. @peerborne/store provides
document subscriptions and lifecycle management without importing React, Vue,
Svelte, networking, or browser globals. Vite is development/build tooling and is
optional at the integration API boundary.
Run the plain DOM example
Section titled “Run the plain DOM example”Use Node.js 26.13.1 and Yarn 4.19.0 from a source checkout. All packages remain unpublished alpha workspaces:
npm install --global corepack@0.36.0corepack enableyarn install --immutableyarn buildyarn workspace @peerborne/integration-examples startOpen the printed URL. The default view uses DOM APIs. Click Start local document, enter a title, and save. The output reflects the real local Peerborne document after its change pipeline runs. The other links exercise optional framework and editor integrations.
Subscribe from JavaScript
Section titled “Subscribe from JavaScript”Once your application has initialized a node, share one store per node/document
path. The example’s complete initialization lives in
browser-session.ts.
import { createDocumentStore } from '@peerborne/store';
const document = peerborne.doc('/workspace');await document.create();const store = createDocumentStore(document, { manageLifecycle: false });const unsubscribe = store.subscribe(render);const release = store.connect();
function render() { const snapshot = store.getSnapshot(); output.textContent = snapshot.status === 'ready' && snapshot.data ? String(snapshot.data.getMap('data').get('title') ?? 'Untitled') : snapshot.status;}
render();await store.change((doc) => doc.getMap('data').set('title', 'Hello'));
// When this consumer is removed:unsubscribe();release();await store.stop();await document.close();create() founds the path, once per node. Opening an existing path from peers
instead needs resolveLoadSecurityCommitments; see
Open existing documents.
subscribe does not open anything. connect opens and retains the shared
document until the last consumer releases it, and longer while
snapshot.deliveryFailure reports a change not known to have reached a
member, up to undeliveredCloseDelay.
Imperative applications can instead await store.start() and
await store.stop(). store.change never opens the document; it rejects with
Document store is closed after the store closes. Every mutation returns a
promise; catch it to report authorization, storage, or signing failures. A
change that is committed but not delivered resolves, and
snapshot.deliveryFailure reports it.
Use snapshot.error for subscription-driven error UI. A retired status means
the document refused a change it could not roll back and must be reopened; see
Local changes that fail before publication.
Snapshots change identity when mutable CRDT state changes. The wrapper and
membership arrays are readonly, but snapshot.data is the actual CRDT: route
all writes through store.change. Peerborne does not support independent
document handles for the same node/path; share the store between consumers.
Existing sites and native modules
Section titled “Existing sites and native modules”Mount a DOM binding in any existing element and remove its listeners when that
element is removed. Custom elements can acquire ownership in
connectedCallback and release it in disconnectedCallback. Neither requires a
framework-specific adapter. A compiled single-file store entry can also be
served as native ESM because it has no runtime dependencies.
The full Peerborne runtime still needs its dependencies resolved for browsers, as the Vite example does. No published CDN URL or standalone prebundled runtime is provided. Build tooling is separate from framework choice.
The example generates a fresh signing identity on reload and has no bootstrap peers, and its Yjs document cannot be shared with another identity. Durable identity/key storage, encrypted checkpoints for reopening after a reload, and new-member onboarding are application work; a document path does not grant access. See Identities and integration evidence.