Powered by a ~19 KB gzipped WebAssembly core (~51 KB raw, <100 KB gzipped bundle) with B+Tree indexes, joins, crash-proof ACID transactions, and reactive multi-tab Live Queries over OPFS & IndexedDB—with zero COOP/COEP server headers.
Multi-predicate range filtering over 5,000 rows in memory
Ported desktop databases serialize queries into SQL text strings only to re-parse them inside a multi-megabyte C parser. WebDB compiles fluent TypeScript directly into compact binary opcodes—delivering a full relational engine with a ~19 KB gzipped Wasm core (~51 KB raw).
Builds SQL text queryString concat & escapingRe-tokenizes & parses text+ Asyncify stack unwindingdb.from("orders").where(...)OP_INDEX_SCAN ➔ OP_RESULT_ROW Stop wiring manual event buses around database writes. WebDB automatically tracks every table accessed by your query—including JOINs and nested subqueries—and pushes instant updates across components and open browser tabs.
Inspects base tables, JOINs, and subqueries automatically—only re-executing when relevant tables mutate.
Commits in another browser tab or Web Worker broadcast via BroadcastChannel and update your UI in real time.
Each framework adapter is an isolated subpath export under 1 KB gzipped with optional peer dependencies.
Because WebDB compiles TypeScript directly into VDBE binary opcodes—skipping SQL string serialization and a multi-megabyte C parser—our ~19 KB gzipped Wasm core (~51 KB raw) outperforms official SQLite WASM (:memory:) across all 6 relational workloads, while even WebDB Pure JS beats SQLite WASM in 4 out of 6 benchmarks.
| Workload Scenario (5,000 Rows • In-Memory) | WebDB (C / WASM) | WebDB (Pure JS) | SQLite WASM (:memory:) | WebDB vs SQLite |
|---|---|---|---|---|
1. Range Filter Scan Multi-predicate range filtering over 5,000 rows in memory | 1,091.7 ops/s Mean 0.92 ms • P95 1.00 ms | 444.0 ops/s Mean 2.25 ms • P95 2.32 ms | 125.9 ops/s Mean 7.94 ms • P95 10.46 ms | 8.7x faster |
2. Bulk Batch Insert 5,000 rows inserted in a single ACID transaction | 359,152 ops/s Mean 13.92 ms • P95 14.41 ms | 301,932 ops/s Mean 16.56 ms • P95 17.14 ms | 156,576 ops/s Mean 31.93 ms • P95 33.57 ms | 2.3x faster |
3. Batch Point Lookups (IN) Primary-key B+Tree point lookups via WHERE id IN (...) | 334,448 ops/s Mean 0.30 ms • P95 0.34 ms | 234,192 ops/s Mean 0.43 ms • P95 0.44 ms | 148,148 ops/s Mean 0.68 ms • P95 0.69 ms | 2.3x faster |
4. Indexed 2-Table JOIN Relational INNER JOIN across 2 indexed tables | 755.3 ops/s Mean 1.32 ms • P95 1.42 ms | 494.6 ops/s Mean 2.02 ms • P95 2.07 ms | 440.1 ops/s Mean 2.27 ms • P95 2.36 ms | 1.7x faster |
5. Filter + Sort + Limit Compound WHERE filter + ORDER BY + LIMIT pagination | 2,381.0 ops/s Mean 0.42 ms • P95 0.47 ms | 681.7 ops/s Mean 1.47 ms • P95 1.52 ms | 1,483.7 ops/s Mean 0.67 ms • P95 0.74 ms | 1.6x faster |
6. Analytics Aggregation GROUP BY with COUNT, SUM & AVG aggregate functions | 2,392.3 ops/s Mean 0.42 ms • P95 0.56 ms | 559.0 ops/s Mean 1.79 ms • P95 1.81 ms | 1,689.2 ops/s Mean 0.59 ms • P95 0.60 ms | 1.4x faster |
Engineered from the ground up around browser storage primitives, asynchronous I/O, and compact 4 KB slotted pages.
Unlike desktop C ports that rely on Emscripten’s slow Asyncify stack rewriting, WebDB suspends cleanly on 4 KB page faults. Persist data in high-speed OPFS or IndexedDB, or query multi-gigabyte read-only databases hosted on S3/CDN via Range: bytes=X-Y requests without downloading the file.
Write-Ahead Logging with IEEE 802.3 CRC32 checksums on every 4 KB page guarantees zero corruption across sudden tab closes. Multi-tab readers and writers coordinate automatically via navigator.locks, while onBeforeCommit and changeset.coalesced() make bidirectional offline sync effortless.
Packs UUIDs and ULIDs into 16 raw bytes (58% smaller than 36-char text strings) for sequential, zero-fragmentation B+Tree index inserts.
Up to 8-column composite indexes, index-assisted sorting, hash/nested joins, and full VDBE bytecode disassembly via .explain().
Instead of bundling heavy C ICU/regex libraries into Wasm, register custom JS functions using native Intl, RegExp, and crypto.
Export and restore full indexed databases as Uint8Array or compressed .webdb.gz images in milliseconds—or share live databases via Studio URLs.
Purpose-built to give you the relational power of SQLite with the tiny footprint and zero-config ergonomics of native browser APIs.
| Capability | Raw IndexedDB / Wrappers | Ported Desktop Wasm (SQLite / PGlite) | WebDBBrowser-Native |
|---|---|---|---|
| Bundle Footprint | ~15–40 KB (No SQL engine) | 1 MB – 5 MB+ Wasm binary | ~19 KB Gzipped Wasm Core (~51 KB raw, <100 KB bundle) |
| Relational Joins & Subqueries | Manual JS loops & cursor merges | Full SQL text parser | Direct-to-Bytecode JOINs, GROUP BY & Subqueries |
| Reactive UI Hooks | Basic table-level polling/hooks | DIY wrappers / manual invalidation | <1 KB Subpaths for React, Vue, Angular & JS with auto-JOIN tracking |
| Server Isolation Headers | None required | Requires COOP/COEP for SharedArrayBuffer | Zero Headers — runs on any static host or CDN |
| Async Storage & S3 Streaming | IndexedDB only | Emscripten Asyncify shims | Native Async VFS (OPFS, IDB, Memory, HTTP Range) |
Write and execute queries in Monaco Editor, inspect binary 4 KB slotted pages in real time, visualize B+Tree structures, and open remote .webdb.gz databases directly via shareable URLs.
Measure real-time ops/sec throughput, latency percentiles, and memory footprint against Raw JS Arrays, Native IndexedDB, and official SQLite WASM directly in your browser.