Installation

Install Minnow, choose direct SQL or Kysely, and open a database.

Install the engine for direct SQL:

npm install @minnowdb/core

Minnow 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 kysely

Reactive React views and streaming files are separate, optional packages:

npm install @minnowdb/react @minnowdb/export
InterfaceWhat it provides
@minnowdb/coreDirect SQL, pull-driven cursors, and the live-query foundation.
@minnowdb/kyselyKysely dialect, inferred schema types, streaming, and typed live queries.
@minnowdb/reactReact external-store hooks with optional Suspense and stale refreshes.
@minnowdb/exportStreaming CSV and NDJSON over direct or worker query cursors.
@minnowdb/devtoolsEmbeddable 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

ImportWhat it contains
@minnowdb/coreMinnowDatabase, schema management, catalog access, errors, and engine types.
@minnowdb/core/storageIndexedDB, OPFS, and memory stores plus the shared BlockStore interface.
@minnowdb/core/storage/indexeddbIndexedDB adapter only; prefer this in application bundles.
@minnowdb/core/storage/opfsOPFS adapter only; prefer this in application bundles.
@minnowdb/core/storage/memoryIn-memory adapter only.
@minnowdb/core/storage/contractsStorage interfaces, records, limits, and errors without an adapter.
@minnowdb/core/storage/snapshotsPortable snapshot framing and streaming helpers.
@minnowdb/core/storage/persistenceOrigin-persistence policy without loading a storage adapter.
@minnowdb/core/clientMinnowDatabaseClient, the main-thread API for a worker-hosted engine.
@minnowdb/core/querySQL compilation, standalone execution, binding, and plan inspection.
@minnowdb/core/liveTyped, keyed, and low-level live-query APIs.
@minnowdb/core/schemaSchema DSL, typed-table renderer, and migrations without the database engine.
@minnowdb/core/schema-wireSchema serialization for worker and adapter tooling.
@minnowdb/core/worker-hostManual worker-host wiring for custom worker entry points.
@minnowdb/core/workerThe 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/autoA worker entry bundling the two durable stores, for { kind: "auto" }.
@minnowdb/core/planLow-level plan-building tools for custom query layers.
@minnowdb/core/storage/toolkitReusable parts for custom storage adapters.
@minnowdb/core/testingFault injection, deterministic simulation, SQLLogicTest, and the storage test kit.
@minnowdb/core/block-formatThe stored block encoding for tools that inspect blocks directly.
@minnowdb/core/transactionsLow-level snapshots, transactions, and recovery tools.
@minnowdb/core/worker-protocolWorker request, response, and event types.
@minnowdb/kyselyThe optional Kysely dialect and schema-to-Kysely type inference.
@minnowdb/kysely/helpersTyped nested JSON projection helpers for Minnow SQL.
@minnowdb/reactReact hook for typed live queries and keyed changes.
@minnowdb/exportBackpressure-aware CSV and NDJSON query streams.
@minnowdb/devtoolsThe optional SQL console and data browser.

On this page