Why are so many apps cloud-based? π€¨
Most of the apps I use would work better offline. Examples are workout tracking, journals, personal finance.
Plus you can sprinkle some syncing to move your data between devices + backups β¨
Well, this is my vision for truly local apps π
Diet tracking online?
I am using an app to track what I eat.
Every time I open it, it takes 2+ seconds to load my data from the cloud π€¦
And the app doesn't even work offline (of course) π€¦
Why a diet tracking app needs to push my (personal) data on the cloud with every interaction? π
Answer: it doesn't.
That's the perfect example for the kind of app that is made for local-first:
- Deals with private data
- Single-user without collaboration
- Great benefits for working offline
The same as any other tracking app (timers, workouts, mood).
But none of them it's truly offline-first/local-first π«
Local-only is a solved problem
I have already published plenty of resources for local-only (e.g. Local-only calories tracker app).
With solutions like IndexedDB (Dexie), SQLite, Pglite, local-only storage is solved π«‘
All it takes is calling store
pointing at your local storage, instead of fetch
to send everything down the network.
It makes for an astounding UX, and an even faster and more satisfying DX. Win-win.
And indeed, many apps would work without issues local-only, diet tracking it's again a perfect example ππΌββοΈ
Syncing: backup and multi-device support
The major issue with local-only is your data being trapped on a single device.
Even if it's just me, I may want to view/share the same data on multiple of my devices π€
That's the role of the cloud. But it starts and stop there for something like diet tracking: backup my data (in case a device is lost) and share my data to other devices.
CRDTs are the solution
Syncing can get tricky. But reducing the scope to backup and sync makes it way easier π
Especially if you don't need features like real-time collaboration (why would you? It's just you, you are not supposed to use 2 device at the same time).
In this context, CRDT can do all the heavy-lifting:
With solutions like Loro and Yjs, CRDTs in TypeScript are a solved problem (more or less) π«‘
In its most simple form, it comes down to a single sync
endpoint (that stores the client updates, and responds with the latest snapshot).
Multi-user/device auth
The server is also ideal for Authorization π
I am about to release an open-source web sync engine that includes syncing and auth:
- Client owns its own
workspace
(offline) - Client (owner) notifies server, syncing starts
- Client (owner) can share access to other clients
- Server keeps backup of data and tokens for each client (Auth+Storage)
Open source Web Sync Engine incoming π Completed first working version, soon coming public π Client and server with @EffectTS_ and @tan_stack router (Web Workers) π @loro_dev as CRDT π Dexie local storage (IndexedDB)
That's my vision for my personal apps:
- I can use them offline/single-device
- I can sync for backups and multi-device
- I can share access to other devices, while still having full auth control
Keep an eye open for more apps like this in the future (and not just from me π)
Countdown started for the Effect Days.
Topic reveal: my talk will be all about Effect on the Frontend π
This is the main reason you should consider @EffectTS_ Effect is just TypeScript, so you can just `pnpm add effect` and you are ready to go This and more on my talk at the Effect Days 25 π
Be ready for a great experience, and a full recap from me on this newsletter π
See you next π