Async SQLite WASM with OPFS persistence for frontend apps (React, Next.js, Vite). Version 1.0.2 uses @sqlite.org/sqlite-wasm (peer dependency ≥3.45.0-0) with OO API #1 in a dedicated worker, avoiding the deprecated Worker1 promiser. Supports OPFS for persistent storage when cross-origin isolated, with automatic fallback to in-memory. Ships TypeScript types and provides a Vite plugin. Requires COOP/COEP headers and correct worker asset copying.
npm install sqlite-promiserNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a SQLite database, creates a table, inserts and queries rows, then closes connection.
Ensure all three files are in the same directory as the worker URL.
Set headers: Cross-Origin-Opener-Policy: same-origin; Cross-Origin-Embedder-Policy: require-corp or credentialless.
Serve sqlite3-opfs-async-proxy.js with Content-Type: text/javascript and same-origin.
Use createDatabase from sqlite-promiser instead of sqlite3Worker1Promiser.
Run: pnpm add @sqlite.org/sqlite-wasm
Import and configure vitePlugin from 'sqlite-promiser/vite' in vite.config.ts.
Set COOP/COEP headers: Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corp or credentialless.
Copy sqlite-oo1-worker.js to public/ or configure Vite plugin.
Run: pnpm add @sqlite.org/sqlite-wasm@>=3.45.0-0