I've been following @replicache for a few months now and it's the real deal. Congrats to the team on the launch!

❔Why is it so exciting for the future of app dev?

🔄 It makes offline-first realtime collaborative apps easy without you having to hand over your backend.

more 👇 https://twitter.com/aboodman/status/1387831967865982979
Replicache is essentially two parts:

1) A client-side sync engine, written in Rust & loaded via wasm.

2) A client-side library which handles local state.

There is no "backend", there is only *your* backend. This sets it apart from other multiplayer solutions on the market.
To support the sync engine, your backend provides two endpoints: one for pull, and one for push.

Pull handles serving up initial state (think: json blob) along with updates; and push handles receiving mutations.
After the client receives the initial state, it keeps track of it in a highly-optimised local store.

The store replaces redux/MobX/whatever-you're using-for-local-state; components subscribe to what they need and thus only update when the data changes.

Huge performance win.
When your FE code issues a mutation the updates are applied immediately (optimistically) so visual performance is snappy & not affected by latency.

They're then batched and sent to the push endpoint by the sync engine. It's the backends job to confirm or reject the mutation.
Rejected mutations are handled by the sync engine automatically and it uses a git-like rebase mechanism (massively simplified) to ensure the local data matches what the server deems OK.

This is not full CRDT - this is Figma-style relying on a central server to act as the boss.
As for other clients, they are all pull only.

So you have two options for keeping them in sync:

1) periodic pulls, this is the basic option.

2) get your server to poke-on-update via a basic pub-sub socket system; that will tell all other clients to pull the latest changes.
The coolest thing about it is the clients don't care where the backend is and thus you are free to host it how you please!

Old-school monolith Rails app? Fine.

Nu-skool serverless app using Vercel/Netlify/Lambda? Also cool - the backend process can be fully stateless!
The one catch: it's a paid product. But this quality doesn't come for free & @aboodman et al. have worked their butts off to deliver it.

The pricing is incredibly reasonable with a fairly hefty free-usage tier too (500 clients!)
You can follow @djm_.
Tip: mention @twtextapp on a Twitter thread with the keyword “unroll” to get a link to it.

Latest Threads Unrolled: