jazz-wasm
raw JSON →WebAssembly bindings for the Jazz database engine, a local-first, real-time collaborative CRDT database. This package provides a WASM build of the core cojson library, enabling high-performance use in browser and Node.js environments. Current stable version is v0.20.17, with alpha releases for v2.0.0. Jazz is built on top of the CoJSON CRDT library and supports transparent sync, offline-first, and conflict-free replicated data types (CRDTs). Key differentiators include automatic conflict resolution, no central server required, and integrated reactive queries for real-time UI updates. Jazz-wasm specifically targets environments where native bindings are unavailable or where a portable binary is needed. It ships TypeScript types and is designed to be used alongside jazz-tools.
Common errors
error Error: Cannot find module 'jazz-wasm' ↓
error TypeError: Failed to fetch dynamically imported module: https://example.com/jazz-wasm.wasm ↓
error Uncaught (in promise) RuntimeError: memory access out of bounds ↓
Warnings
breaking jazz-wasm v2.0.0-alpha drops support for CommonJS require(). Use ESM imports only. ↓
deprecated The 'jazz-wasm' package is being renamed to 'cojson-core-wasm' starting from v0.20.17. ↓
gotcha jazz-wasm must be imported before any jazz-tools or cojson usage. Failure results in missing WASM module errors. ↓
gotcha The WASM module requires a secure context (HTTPS or localhost) in browsers. Mixed content may block loading. ↓
Install
npm install jazz-wasm yarn add jazz-wasm pnpm add jazz-wasm Imports
- default
import 'jazz-wasm' - initialize wrong
const { initialize } = require('jazz-wasm')correctimport { initialize } from 'jazz-wasm' - ready wrong
import { waitForReady } from 'jazz-wasm'correctimport { ready } from 'jazz-wasm'
Quickstart
import 'jazz-wasm';
import { co } from 'jazz-tools';
// Create a simple collaborative counter
const counter = co.create({ value: 0 });
// Listen for changes
counter.subscribe(() => {
console.log('Counter:', counter.value);
});
// Update the counter
counter.value += 1;