Registry / database / mikro-orm-sqlite-wasm

mikro-orm-sqlite-wasm

JSON →
library2.23.0jsnpmunverified

An experimental SQLite driver for MikroORM using WebAssembly, targeting browser and edge runtime environments where native SQLite bindings are unavailable. Version 2.23.0 supports MikroORM v6 and provides an in-memory SQLite database through sql.js WASM. Key differentiators: enables MikroORM in non-Node.js runtimes, zero native dependencies. Currently in active development with frequent releases; breaking changes possible. Compared to better-sqlite3, this driver is browser-compatible but slower and limited to in-memory databases. It is part of the Graphweaver headless CMS ecosystem but can be used standalone. Does not support disk persistence or WAL mode.

npm install mikro-orm-sqlite-wasm
INSTALL
IMPORT
SIG · MIKRO-ORM-SQLITE-W
M
mikro-orm-sqlite-wasm
databasejavascriptv2.23.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SqliteWasmDriver
import { SqliteWasmDriver } from 'mikro-orm-sqlite-wasm'
import SqliteWasmDriver from 'mikro-orm-sqlite-wasm'
Named export, not default. ESM-only; CJS require will not work.
MikroORM
import { MikroORM } from '@mikro-orm/core'
import { MikroORM } from 'mikro-orm-sqlite-wasm'
MikroORM is from @mikro-orm/core, not this package.
initORMSqliteWasm()
import { initORMSqliteWasm } from 'mikro-orm-sqlite-wasm'
Helper function to initialize MikroORM with this driver in a single call.

Initialize MikroORM with the SQLite WASM driver for in-memory database usage.

import { MikroORM } from '@mikro-orm/core'; import { SqliteWasmDriver } from 'mikro-orm-sqlite-wasm'; const orm = await MikroORM.init({ entities: ['./dist/entities'], driver: SqliteWasmDriver, dbName: ':memory:', }); const em = orm.em.fork(); // Your code here await orm.close();
Debug
Known issues
breakingOnly supports ':memory:' databases; file paths are ignored and will cause errors.
fix
Always set dbName to ':memory:' in configuration.
affects: <3.0.0
deprecatedThe driver constructor accepts unsupported options silently overriding defaults.
fix
Use only documented options; remove custom settings.
affects: >=2.0.0 <2.20.0
gotchaWASM file loading is asynchronous; driver initialization may fail in synchronous contexts.
fix
Ensure top-level await or use a Promise-based setup.
affects: >=1.0.0
gotchaNo support for transactions across multiple connections or WAL mode.
fix
Use a single connection and expect lower concurrency.
affects: >=1.0.0
Errors
Common errors & fixes
Error: SQLite WASM not initialized: MikroORM cannot find driver 'SqliteWasmDriver'
Import path mistake or missing driver registration.
fix
Ensure import { SqliteWasmDriver } from 'mikro-orm-sqlite-wasm' and pass as driver option.
TypeError: Cannot read properties of undefined (reading 'exec')
WASM not loaded because of missing sql.js dependency or incorrect initialisation.
fix
Install sql.js as a dependency and ensure it's available in your runtime.
MikroORM requires a driver to be specified or autodiscovered
Driver not provided or incorrectly imported.
fix
Add driver: SqliteWasmDriver to MikroORM.init() options.
Upgrade
Version history
2.23.0latest on npm
Audit
Dependencies
@mikro-orm/corerequiredPeer dependency for MikroORM core library; required in version >=6.0.0
sql.jsrequiredRuntime dependency providing SQLite WASM bindings
Agent activity
7 hits · last 30 days
node
6
Resources
mikro-orm-sqlite-wasm — npm install mikro-orm-sqlite-wasm · libregistry