I have moved some things around in order to have multiple experiments and examples in the same repo.
Each folder is described below.
This shows an example of using an in-memory database. It runs on the main thread and might be used within hooks as any such database connection might be.
There is a README with more details.
Uses web workers to handle all interactions with the database (still in-memory). Worker interactions use a pub/sub approach. See README for details.
Built from "worker", this example, a text box is available to enter SQL or DML. The README has some things to copy/paste or make up your own!
Built from textbox, this example moves important aspects to the an application context, making the database easily available to all parts of the application.
The demo loads a table using a dump file from sqlite3 CLI. It runs way too slow. See readme for more. And the "load_db" demo below.
This demo shows loading a database table with almost 99k rows by using a transaction and binding parameters to the inserts. This loaded in about 6s. Much better than the import_dump demo.
Created from load_db above. I had to tweak the nextjs config to add the headers required by OPFS. This did not work until I found this article: vercel/next.js#17991 which shows how to apply the headers to all pages.