New Crate: Diesel + Persistent SQLite for the Browser with WASM

Hey All!

Wanted to post an announcement about a crate we've been working on. It lets you use Diesel ORM + SQLite with OPFS in the browser for persistent in-browser SQLite databases. We're using it for an e2e encrypted group chat SDK, but i'm sure there many more creative uses for it! It could probably be helpful for any web-app that needs fast, light persistent storage.

The crate so far: libxmtp/diesel-wasm-sqlite at wasm-backend · xmtp/libxmtp · GitHub

Will be talking about it live here: XMTP Dev Call: wen group chat web (Tuesday 8/27 9AM PST/12EST)

It's still under active development, but most queries should work! Namely, returning clause with sqlite does not work yet, because of a private function in diesel.

Will be pulled out into it's own repository and posted on crates as soon as it gets cleaned up a bit.

Before then I'll be talking about it live (link above) if anyone is interested in how it works/wants to offer suggestions for features. Would welcome any WASM experts help me make it more performant. (Figuring out how to share memory between the library host instance, and the separate SQLite WASM blob would be huge) as well as anyone with questions on how to use it!

2 Likes

I just saw GitHub - DallasHoff/sqlocal: SQLocal makes it easy to run SQLite3 in the browser, backed by the origin private file system. being presented at ViteConf 2024 is live! and was curious if something like this exists for Rust, so I googled sqlite WebAssembly rust and found your post here.
But it seems your link is dead (404).
Where is diesel-wasm-sqlite now? :slight_smile:

Hey Boscop!

Thanks for your interest, It has its own repository now: GitHub - xmtp/diesel-wasm-sqlite: A SQLite WebAssembly backend for Diesel

Working on getting the first clean/functional release by dogfooding it in xmtp/libxmtp, and finishing up some changes needed in diesel for another crate release. Feel free to try using it, i'm active in xmtp discord or official rust discord if you have any questions :slight_smile:

1 Like