The local-first nostr app development manifesto (in progress)

Web apps are brittle toys in comparison.

Reply to this note

Please Login to reply.

Discussion

How does the local relay know which relay to download things from when the user is in specific screens? Like a User profile, for instance, needs to use the users inbox and outbox relays and all that data can be deleted as soon as the user closes the screen.

we can connect to remote relays in anyway we want and fetch data in any way we want, the local relay is just for creating a single place to read from to simplify frontend logic and to make it robust to DoS and attacks.

Everytime we see a note come off the wire from a relay we also record that in the note relay index.

Ohh, then that is exactly what Amethyst does. I thought you had discovered some magic :)

when I open amethyst without internet it doesn’t work, i don’t think its the same ?

The ui is only based on local subscriptions, remote connections only dump data into nostrdb

We don't have the disk db, but there is a full in-memory relay that all screens pull and save to before reaching for externals. And when the externals bring new info, the reactive flow will update each intermediary cache until it reaches the screen and updates it. Since Android doesn't kill the app that frequently, the cache just stays on for days or weeks in some cases.

the disk db is nice so you can still use all your apps while your internet is down, but this might only be useful if you are building a microapp browser.

It's only useful if the app is getting killed too many times. Otherwise, in-memory relay does work offline too ( albeit we never really focused too much development on it ).

In most normal cases, Android will put the RAM of the app in zRAM to free memory for other apps and recovering that when the user brings the app back from background.

My heavy user for instance only sees an app restart with clear db once a month or so.

Very cool.

network + key 💜🔑

That's not a fair how Web Apps works in that diagram (they can, but they use a local database too just as pointed out in the nostr apps diagram). Your backend server can ran locally too, within a web app.