Repo of the Day
ahmad-moussawi/webdb
Published: Dec 5, 2026
Open repository ↗An ultra-lean, browser-native relational database engine
Summary
WebDB is a browser-focused relational database engine written in TypeScript, with a C implementation compiled to WebAssembly and a JavaScript query builder that compiles queries into compact bytecode. It combines relational operations, persistent browser storage, transactions, and reactive queries for offline-first applications.
What it is useful for
WebDB is useful when an application needs more than IndexedDB’s key-value and cursor model but wants to keep data access local to the browser. For example, a team could define a users table with UUID, text, integer, and floating-point columns; create a secondary index on score; insert records individually or in bulk; and query users by age, nullability, score, and sort order.
The execution engine and storage layer are separate. WasmEngine and JsEngine can be paired with IdbStorage, OpfsStorage, or MemoryStorage. IndexedDB is intended for environments such as Safari, mobile WebViews, and private browsing, while OPFS targets desktop browsers and workers.
Reactive queries can update React, Vue, Angular, or plain-JavaScript interfaces when relevant tables change, including changes from another browser tab. The documented CLI can also inspect schemas, run queries, explain execution plans, examine pages, and verify .db files.
There are important limitations. The README describes the project as an early prototype or “walking skeleton,” with full V1 engine development still underway, and the npm release is marked alpha. It is primarily intended for browsers. Node.js 20+ support covers testing, SSR, build-time database snapshots, CLI work, and experimental single-process filesystem persistence; it is explicitly not positioned as a multi-process server replacement for SQLite or PostgreSQL.
How engineers can use it
Install the package with a documented command:
npm install @ahmadmoussawi/webdb
Then open a database with an explicit engine and storage backend:
import { WebDB, WasmEngine, IdbStorage } from "@ahmadmoussawi/webdb";
const db = await WebDB.open({
engine: new WasmEngine(),
storage: new IdbStorage("app_data"),
});
await db.createTable("users", [
{ name: "id", type: "UUID", flags: { primaryKey: true } },
{ name: "name", type: "TEXT", flags: { notNull: true } },
{ name: "age", type: "INT32" },
{ name: "score", type: "FLOAT64" },
]);
await db.insert("users", {
id: crypto.randomUUID(),
name: "Alice",
age: 28,
score: 95.5,
});
const topAdults = await db
.from("users")
.where("age", ">=", 21)
.orderBy("score", "desc")
.limit(10)
.toArray();
For transactional writes, the README shows db.transaction() with nested transactions acting as savepoints. It also documents modular imports for a pure JavaScript engine, OPFS storage, and framework-specific live-query bindings. The browser Studio playground is available for trying queries without local setup, while the README’s storage guide and limitations page provide the relevant configuration details.