← Back to context

Comment by satvikpendem

2 years ago

As someone who very closely watches this CRDT and local-first space, it's really quite a bit harder than doing it the old fashioned client-server-model way, because you have to architect your systems to sync seamlessly when offline and then online. I've used tRPC and GraphQL before and I've really been thinking of something where we'd have the same DX as the client-server model such as with tRPC and GraphQL but in a way where there is no difference between client and server state, there is only "state." This makes sense because for local-first, the entire state of the app must be replicated locally anyway.

Recently there have been CRDT solutions that try to solve this problem, however, such as Triplit [0], or ElectricSQL [1].

[0] https://news.ycombinator.com/item?id=37584049

If the same effort were put into software stacks for this as gets put into stacks for cloud-first development and massively scalable devops, there would be lots of canned solutions to all these problems that are very mature and stable. You wouldn't have to know what a CRDT is or how NAT hole punching works any more than you need to know how a data center fabric or a SAN works to use cloud.

See my other reply: https://news.ycombinator.com/item?id=37743517#37746101

Meteor wrapped the MongoDB API for this purpose. You are working with collections and can run the same queries over them, regardless of whether you are connected to a DB instance or the browser's local storage.

For CouchDB an equivalent exists in the form of PouchDB: https://pouchdb.com/

Interestingly, the UK Post Office injustice scandal seems to have occurred because they (and their contractors) couldn't get to the bottom of errors in a local-store distributed system, and ended up blaming (and prosecuting!) Users. And that was just a distributed append only message store, not something as complex as CRDTs

  • Yes people think local-first sounds fun but in mission-critical scenarios it's horrible. Post Office abandoned it as soon as networks got good enough (~2010) with the old local-first replicating version being phased out as "Horizon Legacy" in favour of a new always-online version.

    It didn't stop the bugs. There are lots of ways to screw up even in a fully online system. It certainly helped though!