Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

The linked projects (https://vlcn.io and https://github.com/vlcn-io/cr-sqlite) are both extremely impressive, and open up the possibility of adding "multiplayer" to apps that rely on SQLite for local storage—including web apps, via a WASM build of SQLite.


That could be nice with D1.


Yep! That was one plan for deploying cr-sqlite to "the cloud."

D1, unfortunately, doesn't support loading extensions into SQLite.

fly.io, and their sqlite solution, does however!

I've been using fly.io to run cr-sqlite in the cloud and act as a sync server for non peer to peer use cases. Eventually I'll have finished up a re-write of strut.io[1] atop vlcn/cr-sqlite which'll serve as a good end to end example of how to make applications with this sort of architecture.

Some discussion about this setup on the fly.io forums: https://community.fly.io/t/litefs-many-tens-to-hundreds-of-t...

[1] https://github.com/tantaman/strut


D1 is eventually consistent so better not use it with that. I'd rather use Durable Objects


I believe that the entire point of using CRDTs in your database is eventual consistency. (At least, to some degree. The definition/requirements of "consistent" may change from app to app.)


Could you elaborate? What problem would using CRDTs solve in the context of a web-based app, especially one built with WASM? I've heard of offline-first web apps but am not aware of much use cases for CRDTs there.


I'm using cr-sqlite right now in my Anki clone: https://github.com/AlexErrant/Pentive

It's basically an offline-first flashcard webapp. CR-Sqlite allows for incremental syncing.

With Anki (the app from which I'm taking my inspiration), syncing is _not_ incremental - basically it just copies SQLite files around. So for example, the app could be on an iPhone with cards a card `A` reviewed, but the app on an iPad could make changes to the template on which card `A` is based, and that's enough to cause a conflict - you must take changes from only the iPad or only the iPhone. (To be clear - Anki does have some incremental syncing capabilities - I'm picking an intentionally pathological example.) CR-SQLite will mean that everything is incremental, however.

Basically makes 3 way merges a breeze (or n-way merges, really).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: