{"id":14156606,"url":"https://github.com/sqlite/sqlite-wasm","last_synced_at":"2026-04-21T22:07:25.664Z","repository":{"id":153325292,"uuid":"627300541","full_name":"sqlite/sqlite-wasm","owner":"sqlite","description":"SQLite Wasm conveniently wrapped as an ES Module.","archived":false,"fork":false,"pushed_at":"2026-04-14T12:07:56.000Z","size":5909,"stargazers_count":972,"open_issues_count":2,"forks_count":85,"subscribers_count":14,"default_branch":"main","last_synced_at":"2026-04-14T14:14:34.313Z","etag":null,"topics":["esm","opfs","origin-private-file-system","sqlite","sqlite-wasm","sqlite-webassembly","sqlite3","sqlite3-wasm","webassembly"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sqlite.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-04-13T07:24:18.000Z","updated_at":"2026-04-14T12:08:02.000Z","dependencies_parsed_at":"2023-11-27T10:25:44.124Z","dependency_job_id":"5312160f-a694-4c3e-84d9-08f83236850b","html_url":"https://github.com/sqlite/sqlite-wasm","commit_stats":null,"previous_names":["sqlite/sqlite-wasm","tomayac/sqlite-wasm"],"tags_count":38,"template":false,"template_full_name":null,"purl":"pkg:github/sqlite/sqlite-wasm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqlite%2Fsqlite-wasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqlite%2Fsqlite-wasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqlite%2Fsqlite-wasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqlite%2Fsqlite-wasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sqlite","download_url":"https://codeload.github.com/sqlite/sqlite-wasm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sqlite%2Fsqlite-wasm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32112085,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-21T11:25:29.218Z","status":"ssl_error","status_checked_at":"2026-04-21T11:25:28.499Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["esm","opfs","origin-private-file-system","sqlite","sqlite-wasm","sqlite-webassembly","sqlite3","sqlite3-wasm","webassembly"],"created_at":"2024-08-17T08:07:04.409Z","updated_at":"2026-04-21T22:07:25.659Z","avatar_url":"https://github.com/sqlite.png","language":"JavaScript","readme":"# SQLite Wasm\n\nSQLite Wasm conveniently wrapped as an ES Module.\n\n## Installation\n\n```bash\nnpm install @sqlite.org/sqlite-wasm\n```\n\n## Bug reports\n\n\u003e [!Warning]\n\u003e\n\u003e This project wraps the code of [SQLite Wasm](https://sqlite.org/wasm/doc/trunk/index.md) with _no_\n\u003e changes, apart from added TypeScript types. Please do _not_ file issues or feature requests\n\u003e regarding the underlying SQLite Wasm code here. Instead, please follow the\n\u003e [SQLite bug filing instructions](https://www.sqlite.org/src/wiki?name=Bug+Reports). Filing\n\u003e TypeScript type related issues and feature requests is fine.\n\n## Node.js support\n\n\u003e [!Warning]\n\u003e\n\u003e Node.js is currently only supported for in-memory databases without persistence.\n\n## Usage\n\nThere are two ways to use SQLite Wasm:\n\n- [in a worker](#in-a-worker-with-opfs-if-available)\n- [in the main thread](#in-the-main-thread-without-opfs)\n\nOnly the worker versions allow you to use the origin private file system (OPFS) storage back-end.\n\n### In a worker (with OPFS if available):\n\n\u003e [!Warning]\n\u003e\n\u003e For this to work, you need to set the following headers on your server:\n\u003e\n\u003e `Cross-Origin-Opener-Policy: same-origin`\n\u003e\n\u003e `Cross-Origin-Embedder-Policy: require-corp`\n\n```js\n// In `main.js`.\nconst worker = new Worker('worker.js', { type: 'module' });\n```\n\n```js\n// In `worker.js`.\nimport sqlite3InitModule from '@sqlite.org/sqlite-wasm';\n\nconst start = (sqlite3) =\u003e {\n  console.log('Running SQLite3 version', sqlite3.version.libVersion);\n  const db =\n    'opfs' in sqlite3\n      ? new sqlite3.oo1.OpfsDb('/mydb.sqlite3')\n      : new sqlite3.oo1.DB('/mydb.sqlite3', 'ct');\n  console.log(\n    'opfs' in sqlite3\n      ? `OPFS is available, created persisted database at ${db.filename}`\n      : `OPFS is not available, created transient database ${db.filename}`,\n  );\n  // Your SQLite code here.\n};\n\nconst initializeSQLite = async () =\u003e {\n  try {\n    console.log('Loading and initializing SQLite3 module...');\n    const sqlite3 = await sqlite3InitModule();\n    console.log('Done initializing. Running demo...');\n    start(sqlite3);\n  } catch (err) {\n    console.error('Initialization error:', err.name, err.message);\n  }\n};\n\ninitializeSQLite();\n```\n\nThe `db` object above implements the\n[Object-Oriented API #1](https://sqlite.org/wasm/doc/trunk/api-oo1.md).\n\n### In the main thread (without OPFS):\n\n```js\nimport sqlite3InitModule from '@sqlite.org/sqlite-wasm';\n\nconst start = (sqlite3) =\u003e {\n  log('Running SQLite3 version', sqlite3.version.libVersion);\n  const db = new sqlite3.oo1.DB('/mydb.sqlite3', 'ct');\n  // Your SQLite code here.\n};\nconst initializeSQLite = async () =\u003e {\n  try {\n    console.log('Loading and initializing SQLite3 module...');\n    const sqlite3 = await sqlite3InitModule();\n    console.log('Done initializing. Running demo...');\n    start(sqlite3);\n  } catch (err) {\n    console.error('Initialization error:', err.name, err.message);\n  }\n};\n\ninitializeSQLite();\n```\n\nThe `db` object above implements the\n[Object-Oriented API #1](https://sqlite.org/wasm/doc/trunk/api-oo1.md).\n\n## Usage with vite\n\nIf you are using [vite](https://vitejs.dev/), you need to add the following config option in\n`vite.config.js`:\n\n```js\nimport { defineConfig } from 'vite';\n\nexport default defineConfig({\n  server: {\n    headers: {\n      'Cross-Origin-Opener-Policy': 'same-origin',\n      'Cross-Origin-Embedder-Policy': 'require-corp',\n    },\n  },\n  optimizeDeps: {\n    exclude: ['@sqlite.org/sqlite-wasm'],\n  },\n});\n```\n\nCheck out a [sample project](https://stackblitz.com/edit/vitejs-vite-ttrbwh?file=main.js) that shows\nthis in action.\n\n## Demo\n\nSee the [demo](https://github.com/sqlite/sqlite-wasm/tree/main/demo) folder for examples of how to\nuse this in the main thread and in a worker. (Note that the worker variant requires special HTTP\nheaders, so it can't be hosted on GitHub Pages.) An example that shows how to use this with vite is\navailable on [StackBlitz](https://stackblitz.com/edit/vitejs-vite-ttrbwh?file=main.js).\n\n## Projects using this package\n\nSee the list of [npm dependents](https://www.npmjs.com/browse/depended/@sqlite.org/sqlite-wasm) for\nthis package.\n\n## Deploying a new version\n\n(These steps can only be executed by maintainers.)\n\n1. Manually trigger the [GitHub Actions workflow](../../actions/workflows/build-wasm.yml). By\n   default, it uses the latest SQLite tag. This pull request will contain the latest `sqlite3.wasm`\n   and related bindings.\n\n2. Once the above pull request is validated and merged, update the version number in `package.json`,\n   reflecting the current [SQLite version number](https://sqlite.org/download.html) and add a build\n   identifier suffix like `-build1`. The complete version number should read something like\n   `3.41.2-build1`.\n\n## Building the SQLite Wasm locally\n\n1. Build the Docker image:\n\n   ```bash\n   docker build -t sqlite-wasm-builder:env .\n   ```\n\n2. Run the build:\n\n   **Unix (Linux/macOS):**\n\n   ```bash\n   docker run --rm \\\n     -e SQLITE_REF=\"master\" \\\n     -v \"$(pwd)/out\":/out \\\n     -v \"$(pwd)/src/bin\":/src/bin \\\n     sqlite-wasm-builder:env build\n   ```\n\n   **Windows (PowerShell):**\n\n   ```powershell\n   docker run --rm `\n     -e SQLITE_REF=\"master\" `\n     -v \"${PWD}/out:/out\" `\n     -v \"${PWD}/src/bin:/src/bin\" `\n     sqlite-wasm-builder:env build\n   ```\n\n   **Windows (Command Prompt):**\n\n   ```cmd\n   docker run --rm ^\n     -e SQLITE_REF=\"master\" ^\n     -v \"%cd%/out:/out\" ^\n     -v \"%cd%/src/bin:/src/bin\" ^\n     sqlite-wasm-builder:env build\n   ```\n\n## Running tests\n\nThe test suite consists of Node.js tests and browser-based tests (using Vitest Browser Mode). Tests\naim to sanity-check the exported scripts. We test for correct exports and **very** basic\nfunctionality.\n\n1. Install dependencies:\n\n   ```bash\n   npm install\n   ```\n\n2. Install Playwright browsers (required for browser tests):\n\n   ```bash\n   npx playwright install chromium --with-deps --no-shell\n   ```\n\n3. Run all tests:\n\n   ```bash\n   npm test\n   ```\n\n## Deprecations\n\nThe Worker1 and Promiser1 APIs are, as of 2026-04-15, deprecated. They _will not be removed_, but\nthey also will not be extended further. It is their author's considered opinion that they are too\nfragile, too imperformant, and too limited for any non-toy software, and their use is _actively\ndiscouraged_. The \"correct\" way to use this library is documented in [Usage](#usage) section above.\n\n## License\n\nApache 2.0.\n\n## Acknowledgements\n\nThis project is based on [SQLite Wasm](https://sqlite.org/wasm), which it conveniently wraps as an\nES Module and publishes to npm as\n[`@sqlite.org/sqlite-wasm`](https://www.npmjs.com/package/@sqlite.org/sqlite-wasm).\n","funding_links":[],"categories":["Extensions","webassembly","JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsqlite%2Fsqlite-wasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsqlite%2Fsqlite-wasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsqlite%2Fsqlite-wasm/lists"}