-
https://wasi.dev/
wow I didn't know this was a thing. thanks for filling me in!
-
SaaSHub
SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives
-
For server side, you'll likely need a different build of Wasm SQLite, that handles concurrency (and file locking) differently.
Also, WASI is very far from answer (so far). The SQLite amalgamation builds fine for WASI but concurrency is an unsolved issue.
I had to build a VFS from scratch to get my Wasm based SQLite driver into a usable shape.
https://github.com/ncruces/go-sqlite3/blob/main/vfs/README.m...
-
I have been working on one. If you're interested in working on it or contributing, feel free to chime in here:
https://github.com/rhashimoto/wa-sqlite/discussions/154
This essentially requires that we import the sqlite emscripten build via an extern C header in wasm bindgen, and then we need to re-implement the VFS in rust while compiling it in multi-threaded mode to allow for shared array buffer access. After that is all done, we will be able to access SQLite rows as raw wasm bytes. That gives us the ability to implement a rust-sqlite style wrapper or integration. There would still not be some of the niceties such as connection pooling, but in wasm you likely want to use the db in exclusive mode.
-
Got this SQLite build working with rusts diesel sqlite here: https://github.com/xmtp/diesel-wasm-sqlite
I'm gearing up for a 0.2 release this week which should iron out a few kinks, but otherwise you can use the diesel ORM as if its native
-
-
See also https://github.com/electric-sql/pglite.
(Previously discussed 7 months ago: https://news.ycombinator.com/item?id=39477457)
-
You can use DuckDB WASM independently of Pyodide and can extend it with SQLite.
Though it seems to be somewhat limited. I couldn't even check what version it has, since sqlite_version() was missing. Version in the repository [1] is 3.38.1, which is from quite a ways ago.
At the moment DuckDB web shell can't load SQLite extension, since that hasn't been released for yesterday's 1.1.2. Earlier version does work using recently updated WASM edition. That can be extended with spatial including GDAL, vector search etc [2]. Making your own "SQL web shell" wasn't too hard, though docs weren't quite complete enough for me.
[1] https://github.com/duckdb/sqlite_scanner/blob/main/src/sqlit...
-
-
Personally I'm using it for a statically hosted website, so a server-hosted database was never an option. Also with the right driver, it's possible to stream the chunks of the DB as needed rather than sending the full database.
https://github.com/mmomtchev/sqlite-wasm-http
-
If you like, solving these sort of problems, we are tackling them at Fireproof.
Our database API is modeled on CouchDB and MongoDB, but our storage abstractions are along the lines of what you need to build the multi writer WAL you describe.
More details here https://jsr.io/@fireproof/encrypted-blockstore
-
-
LiteVFS can be compiled in a browser and sync with LiteFS cloud: https://github.com/superfly/litevfs
It needs to be run from a worker, though
-
> I couldn't figure out a way to to get emscripten wasm code to play nice with wasm32-unknown-unknown
There is good news there, some people plan to work on making Emscripten and Rust work well in Wasm:
https://github.com/rustwasm/wasm-bindgen/pull/4014#issuecomm...
-
sqlsync
SQLSync is a collaborative offline-first wrapper around SQLite. It is designed to synchronize web application state between users, devices, and the edge.
I believe that streaming changes from SQLite is what https://sqlsync.dev/ is
-
I didn't fully understand this idea of hydration but I also got recently interested in leveraging Wasm, in context of running parts of backend logic using it (eg. regular templating and some Htmx endpoints) to allow certain offline features with regular server-side web frameworks that could use similar Sqlite Wasm datastore as OP.
- Full Django example https://github.com/m-butterfield/django_webassembly
-
Shameless plug for the fastest way to get the serverdata to the client: just send data in the format that sqlite itself uses: https://gitlab.com/sander-hautvast/sqlighter (available in java and rust, no dependencies on sqlite itself). This works well with the wasm build. The java project contains a demo that also shows how to setup the UI code.