Sqlite3 WebAssembly

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

SaaSHub - Software Alternatives and Reviews
SaaSHub helps you find the best software and product alternatives
www.saashub.com
featured
  1. wasi-libc

    WASI libc implementation for WebAssembly

    https://wasi.dev/

    wow I didn't know this was a thing. thanks for filling me in!

  2. SaaSHub

    SaaSHub - Software Alternatives and Reviews. SaaSHub helps you find the best software and product alternatives

    SaaSHub logo
  3. go-sqlite3

    Go bindings to SQLite using wazero (by ncruces)

    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...

  4. wa-sqlite

    WebAssembly SQLite with support for browser storage extensions

    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.

  5. sqlite-web-rs

    A SQLite WebAssembly backend for Diesel

    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

  6. sqlite-wasm

    SQLite Wasm conveniently wrapped as an ES Module.

  7. pglite

    Lightweight WASM Postgres with real-time, reactive bindings.

    See also https://github.com/electric-sql/pglite.

    (Previously discussed 7 months ago: https://news.ycombinator.com/item?id=39477457)

  8. duckdb-sqlite

    DuckDB extension to read and write to SQLite databases

    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...

  9. duckdb-wasm

    WebAssembly version of DuckDB

  10. sqlite-wasm-http

    An experimental HTTP VFS driver for SQLite WASM

    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

  11. jsr

    The open-source package registry for modern JavaScript and TypeScript

    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

  12. orbitdb

    Peer-to-Peer Databases for the Decentralized Web

  13. litevfs

    LiteFS VFS SQLite extension for serverless environments

    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

  14. wasm-bindgen

    Facilitating high-level interactions between Wasm modules and JavaScript

    > 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...

  15. 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

  16. django_webassembly

    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

  17. sqlighter

    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.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts

  • Ask HN: Have you used SQLite as a primary database?

    19 projects | news.ycombinator.com | 25 Apr 2022
  • Generate an OpenAPI From Your Database

    4 projects | dev.to | 27 Dec 2024
  • In Search of a Faster SQLite

    2 projects | news.ycombinator.com | 16 Dec 2024
  • Show HN: Outerbase Studio – Open-Source Database GUI

    19 projects | news.ycombinator.com | 4 Dec 2024
  • Handling TypeORM migrations in Electron apps

    3 projects | dev.to | 24 Nov 2024

Did you know that Rust is
the 5th most popular programming language
based on number of references?