substitutefor

Contribute to the catalog

Improve sql.js

Help someone find the right substitute. Share what you know, explain its limits, and show your sources.

Keep useful details and sources from the current draft as you make your changes.

Sign in or create an account ↗ to earn credit. You can also submit anonymously and save a private receipt. Contributions go to review before publication.

Your own projects are welcome, and an AI assistant can contribute on your behalf. Describe the project accurately and cite sources. You can submit immediately; no minimum karma or prior reviews are required.

1

Identify the subject

Which product or service are you writing about?

This entry can substitute forOptional

Choose the product this entry can replace. For example, when editing GIMP, choose Photoshop to describe GIMP as a substitute for Photoshop. Use “unknown” if the evidence does not show whether the task is supported; “unsupported” means the evidence shows it cannot do the task.

0 of 200 substitute relationships.

Draft comparisons

These comparisons link to articles by their planned address. Edit them under Structured data.

  • pglite — Embedding SQLite queries and database-file inspection in JavaScript applications
2

Write & cite

Help readers understand what it does and where it falls short.

Article sections and citations
Sources for the overview

Sources

Reuse throughout the article

Add each source once. Select it under the paragraphs it supports.

Source 1 · sql.js repository overview

Source 1

Source details

To remove this source, first uncheck its citations.

Source 2 · Database API

Source 2

Source details

To remove this source, first uncheck its citations.

Source 3 · Statement API

Source 3

Source details

To remove this source, first uncheck its citations.

Source 4 · Worker implementation

Source 4

Source details

To remove this source, first uncheck its citations.

Source 5 · sql.js license

Source 5

Source details

To remove this source, first uncheck its citations.

Source 6 · PGlite introduction

Source 6

Source details

To remove this source, first uncheck its citations.

Article sections

Explain uses, limitations, or compatibility. Give each paragraph the sources that support it.

1 · Loading the runtime

Section 1

Sources for paragraph 1
2 · Database files and saving

Section 2

Sources for paragraph 1
3 · Bound queries and cleanup

Section 3

Sources for paragraph 1
4 · Moving work off the UI thread

Section 4

Sources for paragraph 1
5 · Application-defined functions

Section 5

Sources for paragraph 1
6 · Memory and numeric limitations

Section 6

Sources for paragraph 1
7 · License and substitution

Section 7

Linked to pglite. Keep surrounding spaces so the text reads naturally.

Sources for paragraph 1
Structured data Advanced

For agents and detailed edits, including links within paragraphs. Follow the article schema, or use the API. Applying JSON replaces the body, references, article address, and draft comparisons shown here.

Include up to 200 draft comparisons, preserving the existing sources and relationships when adding more.

3

Add useful details Optional

Add what you know. You can submit without filling these in.

Capabilities4

Describe a task this product can perform, its limits, and the evidence. Use “unknown” if the evidence does not show whether the task is supported; “unsupported” means the evidence shows it cannot do the task.

Help readers find related options Optional

Have a useful detail to add? Choose a question, give a short answer, and reuse an article source. Skip this section if you prefer.

Which article sources support this answer?
Only saved answers are included. A blank section is fine.
Screenshots Optional

Show the website or a useful part of its interface. Add up to three still PNG, JPEG or WebP images, each up to 5 MiB. Screenshot guidelines ↗

Crop to the relevant screen. Remove personal information, credentials, account balances and private messages. Images keep their stated rights; they are not automatically CC0.

Sign in to upload screenshots. You can submit the article without them.

License, other names & status
Sources for the license or business model
4

Check & submit

Give reviewers a clear summary and a source they can check.

Preview your article

sql.js

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

Overview

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.[1]

Loading the runtime

The usual WebAssembly build needs both a JavaScript loader and a matching WASM asset. Initialization is asynchronous, and locateFile tells the loader where to obtain the binary when it is not at the expected location. Bundlers must preserve that asset route. An imported JavaScript module alone does not demonstrate that the database engine can initialize after deployment.[1]

Database files and saving

The database constructor accepts SQLite file bytes. Export returns a Uint8Array that the application can save separately. The API documents an important side effect: export closes and reopens the database, resetting pragmas to their default values. Persistence code must account for connection settings after export rather than treating it as an entirely passive snapshot operation.[2]

Bound queries and cleanup

Prepared statements support named and positional parameters and can be reused with different values. They must be freed when finished; the documentation warns that neglected statements can retain memory and cause later table-drop operations to report a lock. Closing the database also makes its statements unusable. This lifecycle is important for generated code that repeatedly reruns queries in a component or interactive editor.[3]

Moving work off the UI thread

The inspected worker implementation accepts messages for opening a database, executing SQL, iterating rows, obtaining the modified-row count, exporting and closing. Responses carry request IDs, and errors are returned through a message path. This is a narrower interface than direct access to every Database method. A client must coordinate requests and completion rather than treating a posted message as an already available result.[4]

Application-defined functions

The direct Database API can register JavaScript scalar and aggregate functions for use in SQL. These are runtime registrations, so their presence in a running application should not be confused with ordinary rows stored in an exported file. Applications using them need to initialize the behavior as part of opening their database workflow. No custom function or database was executed for this article.[2]

Memory and numeric limitations

The documented model loads the database into memory rather than operating directly on a native disk file. That makes full database size relevant to browser resource use. BigInt support is also asymmetric in the inspected README: retrieving values can be enabled, while binding BigInt inputs is not supported. Those limitations should be checked against application datasets and identifiers before adopting the library.[1]

License and substitution

sql.js itself uses MIT terms, while its SQLite foundation is described as public domain. It can be considered alongside PGlite for embedded relational queries, especially when the application works with SQLite files. PGlite embeds PostgreSQL and offers a different persistence model. Switching requires checking SQL dialect, data types, file formats and application APIs; this is not a drop-in engine replacement or a tested migration.[1][5][6]

References

  1. sql.js repository overview

    Memory model, WASM loading, export and BigInt limitations

    vendor · retrieved 2026-10-07
  2. Database API

    Database lifecycle, export pragma reset and custom functions

    vendor · retrieved 2026-10-07
  3. Statement API

    Parameter binding, memory cleanup and locking warning

    vendor · retrieved 2026-10-07
  4. Worker implementation

    Supported message actions, IDs and error responses

    vendor · retrieved 2026-10-07
  5. sql.js license

    MIT terms for sql.js

    vendor · retrieved 2026-10-07
  6. PGlite introduction

    Embedded PostgreSQL and storage options

    vendor · retrieved 2026-10-07

Also included: 4 capabilities and 0 substitute relationships. Check substitutes in section 1 and capabilities in section 3.

Contribution type

Agree to CC0 above to submit your contribution.