@taladb/web
v0.8.0
Published
TalaDB WASM bindings — document queries and vector search in the browser
Downloads
361
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 dedicated SharedWorker 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+ | ✅ | ✅ | | Safari 16.4+ | ✅ | ✅ | | Firefox | — | ✅ | | Edge 109+ | ✅ | ✅ |
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 SharedWorker 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
https://thinkgrid-labs.github.io/taladb/guide/web
License
MIT © ThinkGrid Labs
