Installation
Install Minnow, choose direct SQL or Kysely, and open a database.
Install the engine for direct SQL:
npm install @minnowdb/coreMinnow is plain JavaScript. It has no post-install step, native binary, or WebAssembly module to fetch at runtime.
Add the Kysely adapter if you want a type-safe query builder:
npm install @minnowdb/kysely kyselyReactive React views and streaming files are separate, optional packages:
npm install @minnowdb/react @minnowdb/export| Interface | What it provides |
|---|---|
@minnowdb/core | Direct SQL, pull-driven cursors, and the live-query foundation. |
@minnowdb/kysely | Kysely dialect, inferred schema types, streaming, and typed live queries. |
@minnowdb/react | React external-store hooks with optional Suspense and stale refreshes. |
@minnowdb/export | Streaming CSV and NDJSON over direct or worker query cursors. |
@minnowdb/devtools | Embeddable SQL console panel — floating in dev, inline in a page. |
Minnow is 0.x, so breaking changes can land in minor releases: pin exact @minnowdb versions
and upgrade them together. Engine-dependent
adapters declare the compatible core range for npm; the React hook is structurally typed and has
no core runtime dependency. See Versioning.
Open a database
A database combines the SQL engine with a storage adapter. Start with IndexedDB for durable data in any supported browser:
import { MinnowDatabase } from "@minnowdb/core";
import { IndexedDbBlockStore } from "@minnowdb/core/storage/indexeddb";
const store = await IndexedDbBlockStore.open({ name: "shop" });
const db = new MinnowDatabase(store);Use OPFS in a worker for synchronous file access and log-based persistence:
import { OpfsBlockStore } from "@minnowdb/core/storage/opfs";
const db = new MinnowDatabase(await OpfsBlockStore.open({ name: "shop" }));Use memory for tests and disposable data:
import { MemoryBlockStore } from "@minnowdb/core/storage/memory";
const db = new MinnowDatabase(new MemoryBlockStore());See Storage for the availability, durability, and performance trade-offs.
Run it in a worker
Most interactive applications should put the engine in a worker so query execution does not
compete with rendering. MinnowDatabaseClient exposes the same query, cursor, write, catalog,
index, migration, live-query, snapshot, and maintenance calls on the main thread.
The worker guide includes the ready-made worker entry and bundler setup.
OPFS database deletion additionally requires Web Locks. Close every connection, including tabs running an older build, before deleting a store; see OPFS storage.
Browser requirements
Minnow needs CompressionStream and DecompressionStream plus a storage adapter. Current Chrome,
Firefox, Safari, and Edge support IndexedDB in a window or worker. OPFS requires a dedicated worker and is
unavailable in Safari private browsing.
Minnow targets browsers. It does not ship a Node.js engine build. Use MemoryBlockStore or
fake-indexeddb for Node-based tests. The v1 support policy
defines the tested browser line, OPFS qualification, and release-candidate checks.
Package entry points
| Import | What it contains |
|---|---|
@minnowdb/core | MinnowDatabase, schema management, catalog access, errors, and engine types. |
@minnowdb/core/storage | IndexedDB, OPFS, and memory stores plus the shared BlockStore interface. |
@minnowdb/core/storage/indexeddb | IndexedDB adapter only; prefer this in application bundles. |
@minnowdb/core/storage/opfs | OPFS adapter only; prefer this in application bundles. |
@minnowdb/core/storage/memory | In-memory adapter only. |
@minnowdb/core/storage/contracts | Storage interfaces, records, limits, and errors without an adapter. |
@minnowdb/core/storage/snapshots | Portable snapshot framing and streaming helpers. |
@minnowdb/core/storage/persistence | Origin-persistence policy without loading a storage adapter. |
@minnowdb/core/client | MinnowDatabaseClient, the main-thread API for a worker-hosted engine. |
@minnowdb/core/query | SQL compilation, standalone execution, binding, and plan inspection. |
@minnowdb/core/live | Typed, keyed, and low-level live-query APIs. |
@minnowdb/core/schema | Schema DSL, typed-table renderer, and migrations without the database engine. |
@minnowdb/core/schema-wire | Schema serialization for worker and adapter tooling. |
@minnowdb/core/worker-host | Manual worker-host wiring for custom worker entry points. |
@minnowdb/core/worker | The ready-made worker entry. |
@minnowdb/core/worker/{indexeddb,opfs,memory} | A worker entry bundling one store only, for bundlers that cannot split worker code. |
@minnowdb/core/worker/auto | A worker entry bundling the two durable stores, for { kind: "auto" }. |
@minnowdb/core/plan | Low-level plan-building tools for custom query layers. |
@minnowdb/core/storage/toolkit | Reusable parts for custom storage adapters. |
@minnowdb/core/testing | Fault injection, deterministic simulation, SQLLogicTest, and the storage test kit. |
@minnowdb/core/block-format | The stored block encoding for tools that inspect blocks directly. |
@minnowdb/core/transactions | Low-level snapshots, transactions, and recovery tools. |
@minnowdb/core/worker-protocol | Worker request, response, and event types. |
@minnowdb/kysely | The optional Kysely dialect and schema-to-Kysely type inference. |
@minnowdb/kysely/helpers | Typed nested JSON projection helpers for Minnow SQL. |
@minnowdb/react | React hook for typed live queries and keyed changes. |
@minnowdb/export | Backpressure-aware CSV and NDJSON query streams. |
@minnowdb/devtools | The optional SQL console and data browser. |