@taladb/web
v0.11.8
Published
TalaDB WASM bindings — document queries and vector search in the browser
Readme
@taladb/web
Browser WASM bindings for TalaDB — persistent local-first storage via WASM + OPFS.
Note: Most users should install
taladbinstead, which auto-selects this package when running in the browser.
What it provides
- Rust core compiled to WebAssembly via
wasm-bindgen - Persistent storage using OPFS (
FileSystemSyncAccessHandle) — runs on a DedicatedWorker so the main thread is never blocked - In-memory fallback for environments without OPFS support
- Bundle size target: < 400 KB gzipped
Browser support
| Browser | OPFS (persistent) | In-memory fallback | |---------|-------------------|-------------------| | Chrome 109+ | ✅ | ✅ | | Edge 109+ | ✅ | ✅ | | Safari 16.4+ | ✅ | ✅ | | Firefox 111+ | ✅ | ✅ | | Firefox 89–110 | — | ✅ |
The module is built with WebAssembly SIMD, which does not instantiate on engines that lack it. That sets the floor at Safari 16.4, Chrome 91 and Firefox 89 regardless of storage backend.
Installation
pnpm add taladb @taladb/webUsage
Use through the unified taladb package:
import { openDB } from 'taladb';
const db = await openDB('myapp.db');
const col = db.collection('notes');
await col.insert({ title: 'Hello', body: 'World' });
const notes = await col.find();Vite setup
// vite.config.ts
import { defineConfig } from 'vite';
export default defineConfig({
optimizeDeps: {
exclude: ['@taladb/web'],
},
});Web Worker (OPFS)
TalaDB spawns a DedicatedWorker internally to own the OPFS file handle. No extra configuration is required — the worker script is bundled inside this package at @taladb/web/worker/taladb.worker.js.
Direct usage (advanced)
If you need to use the WASM bindings directly:
import init, { TalaDBWasm } from '@taladb/web';
await init();
const db = TalaDBWasm.openInMemory();
const col = db.collection('items');
col.insert({ x: 1 });Building from source
# Install wasm-pack
cargo install wasm-pack
# Build
pnpm --filter @taladb/web buildFull Documentation
License
Apache 2.0 © TalaDB
