absurd-sql (v0.0.54) is a backend for sql.js that stores SQLite databases in IndexedDB, enabling persistent SQLite storage in the browser with incremental block-level reads/writes rather than full database blobs. It uses SharedArrayBuffer and Atomics for high performance, consistently beating raw IndexedDB by up to 10x. Released as an experimental/absurd project by James Long, with sporadic updates. Key differentiators: true persistence without full DB reload, support for fallback mode without SharedArrayBuffer (Safari), and requiring a worker thread. Not for production use; primarily a proof-of-concept.
npm install absurd-sqlNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up absurd-sql with a worker, mounts SQLite filesystem on IndexedDB, opens a database, and applies recommended PRAGMA.
Configure server to send the required COOP/COEP headers. Without these, SharedArrayBuffer is unavailable and the library may fall back or fail.
Always create a Worker and run all SQLite operations inside it.
Install @jlongster/sql.js instead of regular sql.js, or verify compatibility with your sql.js version.
Implement a custom handler to notify users or prevent multiple tabs from writing simultaneously.
Always execute PRAGMA journal_mode=MEMORY after opening the database.
Wrap fallback code in `if (typeof SharedArrayBuffer === 'undefined') { ... }`.Ensure server sends Cross-Origin-Opener-Policy: same-origin and Cross-Origin-Embedder-Policy: require-corp headers. Also must be served over HTTPS or localhost.
Install 'absurd-sql' and use the correct subpath import: 'absurd-sql/dist/indexeddb-main-thread'.