How long until we see WebAssembly/WebGPU become a platform independent choice for deploying server side code as well?
Sqlite3 WebAssembly
11–20 of 200 posts
Re: Sqlite3 WebAssembly
#12How long until we see WebAssembly/WebGPU become a platform independent choice for deploying server side code as well?
There's a number of WASM platforms/tools: Wasmer, wasmCloud, a few others that escape my memory.
Re: Sqlite3 WebAssembly
#13How long until we see WebAssembly/WebGPU become a platform independent choice for deploying server side code as well?
Yesterday? There's a number of WASM platforms/tools: Wasmer, wasmCloud, a few others that escape my memory.
Re: Sqlite3 WebAssembly
#14Slight point of confusion: that page says: > These components were initially released for public beta with version 3.40 and will tentatively be made API-stable with the 3.41 release, pending community feedback. But the most recent release of SQLite is 3.46.1 (from 2024-08-13) Presumably they are now "API-stable" but the page hasn't been updated yet. It would be great if the SQLite team published an official npm packa…
sqlite-wasm loads much faster than Pyodide, so if you don't need Python, then the former is a better choice.
Re: Sqlite3 WebAssembly
#15Slight point of confusion: that page says: > These components were initially released for public beta with version 3.40 and will tentatively be made API-stable with the 3.41 release, pending community feedback. But the most recent release of SQLite is 3.46.1 (from 2024-08-13) Presumably they are now "API-stable" but the page hasn't been updated yet. It would be great if the SQLite team published an official npm packa…
https://github.com/sqlite/sqlite-wasm sqlite-wasm loads much faster than Pyodide, so if you don't need Python, then the former is a better choice.
npm install @sqlite.org/sqlite-wasmRe: Sqlite3 WebAssembly
#16Slight point of confusion: that page says: > These components were initially released for public beta with version 3.40 and will tentatively be made API-stable with the 3.41 release, pending community feedback. But the most recent release of SQLite is 3.46.1 (from 2024-08-13) Presumably they are now "API-stable" but the page hasn't been updated yet. It would be great if the SQLite team published an official npm packa…
I think they've been doing that for a while, in JS script you can already do this:
import sqlite3InitModule from "https://cdn.jsdelivr.net/npm/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3-bundler-friendly.mjs";
const sqlite3 = await sqlite3InitModule({
locateFile(file: string) {
return "https://cdn.jsdelivr.net/npm/@sqlite.org/sqlite-wasm/sqlite-wasm/jswasm/sqlite3.wasm";
},
});
// SQLite's C API
const capi = sqlite3.capi;
console.log("sqlite3 version", capi.sqlite3_libversion(), capi.sqlite3_sourceid());
// OO API example below oo1 docs https://sqlite.org/wasm/doc/tip/api-oo1.md
const oo = sqlite3.oo1;
const db = new oo.DB();
const createPersonTableSql = `
CREATE TABLE IF NOT EXISTS person (
id INTEGER PRIMARY KEY AUTOINCREMENT,
name TEXT NOT NULL,
age INTEGER NOT NULL
);
`;
db.exec([createPersonTableSql]);
It works in regular old script tag with type=module, or Deno. I have example HTML here:https://github.com/Ciantic/experimenting-sqlite-wasm/blob/ma...
Re: Sqlite3 WebAssembly
#17i’ve been looking for a Tanstack Query style library that is backed by Sqlite (backed by OPFS or some other browser storage) and syncs with an API in the background. Does anything like that exist? i’ve seen ElectricSQL and other sync engines but they are a bit opinionated. I’m pretty new to local-first but i feel like the developer ergonomics are not quite there yet Meanwhile for “local-only” it would be great to use…
For the read path it hooks into Postgres logical replication or MongoDB change streams (and MySQL binlog soon). It supports partial syncing using declarative rules. For the write path, it allows writing to the local SQLite database and also places writes into an upload queue, and then uses a developer-defined function to upload writes to the backend API.
We did a deep dive on current options for SQLite on the web, and are currently using an IndexedDB-based VFS, and looking to move to OPFS: https://www.powersync.com/blog/sqlite-persistence-on-the-web
We recently released an integration with TanStack Query to allow leveraging some of its features in conjunction with PowerSync: https://docs.powersync.com/client-sdk-references/js-web/java...
> Meanwhile for “local-only” it would be great to use sqlite in the browser + native file system API so that the db could be stored on the user’s file system and we wouldn’t have to worry about browser storage eviction. i think that could really open up a whole world of privacy preserving offline software delivered through the browser
Agreed. This is a limitation of IndexedDB and OPFS as persistent browser storage currently
Re: Sqlite3 WebAssembly
#18So after downloading from the official downloads page and stripping away all the mjs files and "bundler-friendly" files, a minimal sqlite wasm dependency will be about 1.3MB. For an in-browser app, that seems a bit much but of course wasm runs in other places these days where it might make more sense.
Also worth considering parsing of wasm is significantly faster than JS (unfortunately couldn't find the source for this claim, there is at lease one great article on the topic)
https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_A...
Re: Sqlite3 WebAssembly
#19So after downloading from the official downloads page and stripping away all the mjs files and "bundler-friendly" files, a minimal sqlite wasm dependency will be about 1.3MB. For an in-browser app, that seems a bit much but of course wasm runs in other places these days where it might make more sense.
Re: Sqlite3 WebAssembly
#20Earlier quoted context omitted.
https://github.com/sqlite/sqlite-wasm sqlite-wasm loads much faster than Pyodide, so if you don't need Python, then the former is a better choice.
Amazing! npm install @sqlite.org/sqlite-wasm
Okay that's listed here: https://sqlite.org/wasm/doc/trunk/persistence.md
EDIT: Self answered.