# sql\.js

SQLite compiled to WebAssembly or JavaScript, with in\-memory databases and explicit file export\.

ID: Q898 · Revision: 946

Type: software · License: MIT wrapper; SQLite is public domain[^license][^readme] · Status: active

Website: https://sql.js.org/



sql\.js compiles SQLite for JavaScript environments, normally through WebAssembly\. It can create or load a SQLite database into memory and query it in the browser\. Changes are not automatically written back to a file or durable browser store; an application must export and save the database when persistence is required\.[^readme]

## Capabilities and substitutions

### SQLite file loading and export — supported

Loads database bytes and exports a SQLite file as Uint8Array; saving is application\-owned\.[^readme][^database]

Use case: Embedding SQLite queries and database\-file inspection in JavaScript applications · Platforms: Web, JavaScript, WebAssembly, Node\.js · Region: Version, build and integration requirements apply

### Automatic durable writes — unsupported

The documented default uses an in\-memory virtual database and does not persist changes automatically\.[^readme]

Use case: Embedding SQLite queries and database\-file inspection in JavaScript applications · Platforms: Web, JavaScript, WebAssembly, Node\.js · Region: Version, build and integration requirements apply

### Prepared statements — supported

Supports bound values and result iteration; statements must be freed after use\.[^statement]

Use case: Embedding SQLite queries and database\-file inspection in JavaScript applications · Platforms: Web, JavaScript, WebAssembly, Node\.js · Region: Version, build and integration requirements apply

### Worker API parity — limited

Worker exposes selected message actions rather than the complete direct Database API\.[^database][^worker]

Use case: Embedding SQLite queries and database\-file inspection in JavaScript applications · Platforms: Web, JavaScript, WebAssembly, Node\.js · Region: Version, build and integration requirements apply

### [Substitute for PGlite](/pglite) — limited

Can replace embedded SQL execution when SQLite and explicit file export fit the task; PostgreSQL schema features and storage formats are not interchangeable\.[^readme][^pglite]

Use case: Embedding SQLite queries and database\-file inspection in JavaScript applications · Platforms: Web, JavaScript, WebAssembly, Node\.js · Region: Version, build and integration requirements apply

## References

[^readme]: [sql\.js repository overview](<https://github.com/sql-js/sql.js/blob/master/README.md>) — Memory model, WASM loading, export and BigInt limitations (vendor; retrieved 2026-10-07T23:43:41Z)

[^database]: [Database API](<https://sql.js.org/documentation/Database.html>) — Database lifecycle, export pragma reset and custom functions (vendor; retrieved 2026-10-07T23:44:55Z)

[^statement]: [Statement API](<https://sql.js.org/documentation/Statement.html>) — Parameter binding, memory cleanup and locking warning (vendor; retrieved 2026-10-07T23:44:02Z)

[^worker]: [Worker implementation](<https://github.com/sql-js/sql.js/blob/master/src/worker.js>) — Supported message actions, IDs and error responses (vendor; retrieved 2026-10-07T23:44:55Z)

[^license]: [sql\.js license](<https://github.com/sql-js/sql.js/blob/master/LICENSE>) — MIT terms for sql\.js (vendor; retrieved 2026-10-07T23:43:48Z)

[^pglite]: [PGlite introduction](<https://pglite.dev/docs/about>) — Embedded PostgreSQL and storage options (vendor; retrieved 2026-10-07T23:43:41Z)

Source revision: https://substitutefor.net/entities/Q898?revision=946
