▲ | dfabulich 4 days ago | ||||||||||||||||||||||||||||||||||||||||||||||||||||
The punchline of this article is that all the implementations they tried (WatermelonDB, PowerSync, ElectricSQL, Triplit, InstantDB, Convex) are all built on top of IndexedDB. "The root cause is that all of these offline-first tools for web are essentially hacks. PowerSync itself is WASM SQLite... On top of IndexedDB." But there's a new web storage API in town, Origin Private File System. https://developer.mozilla.org/en-US/docs/Web/API/File_System... "It provides access to a special kind of file that is highly optimized for performance and offers in-place write access to its content." OPFS reached Baseline "Newly Available" in March 2023; it will be "Widely Available" in September. WASM sqlite on OPFS is, finally, not a hack, and is pretty much exactly what the author needed in the first place. | |||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | jitl 4 days ago | parent | next [-] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
We do see about 10x the database row corruption rate w/ WASM OPFS SQLite compared to the same logic running against native SQLite. For read-side cache use-case this is recoverable and relatively benign but we're not moving write-side use-case from IndexedDB to WASM-OPFS-SQLite until things look a bit better. Not to put the blame on SQLite here, there's shared responsibility for the corruption between the host application (eg Notion), the SQLite OPFS VFS authors, the user-agent authors, and the user's device to ensure proper locking and file semantics. | |||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | isaachinman 4 days ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Yeah, I did fail to mention OPFS in the blog post. It does look very promising, but we're not in a position to build on emergent tech – we need a battle-tested stack. Boring over exciting. | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | aboodman 4 days ago | parent | prev | next [-] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Replicache, which author loves, is also built on top of IndexedDB. But notably, not directly atop. We build our own KV store that uses IDB just as block storage. So I sort of agree w/ you. But if we were to build atop OPFS we'd also just be using it for block storage. So I'm not sure it's a win? It will be interesting to explore. | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||
▲ | ochiba 4 days ago | parent | prev [-] | ||||||||||||||||||||||||||||||||||||||||||||||||||||
PowerSync supports OPFS as SQLite VFS since earlier 2025: https://github.com/powersync-ja/powersync-js/pull/418 |