An htmx extension that enables SQLite database queries directly from HTML attributes using either HTTP remote databases or the Origin Private File System (OPFS) in the browser. Version 1.9.3 wraps the sqlite-wasm-http library to provide declarative CRUD operations via hx-get, hx-put, hx-post, hx-delete attributes, supporting bind parameters and streaming row-by-row responses. It emits custom htmx events for progress and completion. Currently experimental with limited real-world use; requires copying worker files and a .wasm binary to the server due to cross-domain Web Worker restrictions. Key differentiator: brings serverless SQLite to htmx without a backend, but is early-stage and may have caching issues with the default shared backend.
npm install htmx-sqliteNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Basic setup using HTTP remote SQLite database; requires hosting worker and WASM files on same origin.
Copy all dist/sqlite-wasm-http-*.js and dist/*.wasm files to your own server and point script src to local copies.
If changes from other sessions are not visible, force sync backend by using hx-db="http:/mydb.db?sync=true" (not officially documented, but recommended in README).
Consider alternatives like using sql.js directly or a server-side solution for production.
Download SQLite worker files and serve them from your own domain (same origin as the page).
Ensure hx-db attribute uses proper format: 'http:/path/to/db.db' (single slash after colon) or 'opfs:dbname'.
Add hx-ext="sqlite" to the body or a parent element that contains the element with hx-get.