@laboverwire/stitch
v0.5.0
Published
Reactive state synchronization library bridging an in-memory store, IndexedDB persistence, and MQTT-based remote sync.
Maintainers
Readme
@laboverwire/stitch
Reactive state synchronization for React and Vue. A thin, framework-agnostic binding layer over @laboverwire/stitch-wasm — a Rust/WASM package that owns the in-memory store, IndexedDB persistence, and MQTT-based remote sync. This package wraps that WASM Store in a small adapter and ships React and Vue 3 bindings on top; all store, sync, persistence, and offline-queue logic lives inside the WASM.
npm install @laboverwire/stitchimport { createStore } from '@laboverwire/stitch';
const store = createStore<Schema>(config, {
persistence: { dbName: 'my-app' },
remote: { url: 'wss://mqtt.example.com', ticket: await fetchAuthTicket() },
});
await store.initialize();
await store.replaceScope('project-abc');
const tasks = store.getSnapshot('task', 'project-abc');remote.url is a ws:///wss:// MQTT endpoint. Pass ticket (a JWT) for MQTT v5 enhanced auth, or username/password for classic password auth. A persistence.passphrase enables AES-GCM encryption of the IndexedDB store.
Documentation
- Configuration —
StoreConfig,StoreOptions, scope model, typed schemas - Store API — full method reference
- React bindings — providers, hooks, runnable example
- Vue 3 bindings — providers, composables, runnable example
- Concepts — origin tags, offline queue, reconciliation, connection resilience
- Vite consumer guide — consuming apps must add
vite-plugin-wasm(andvite-plugin-top-level-await) so the bundler can load the WASM module - Architecture — layer composition, data flow, invariants
- Upgrading to 0.5.0 — breaking changes and step-by-step upgrade from 0.4.x
- Changelog
- Releasing
examples/ contains runnable vanilla-TS, React, and Vue apps that double as reference implementations.
License
Apache-2.0 — see LICENSE.
