Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: How do you design offline-first flows in large React Native apps?
2 points by samwellx 22 days ago | hide | past | favorite | 3 comments
I’m working on a mobile app where offline-first is a real requirement (not just caching).

The tricky parts are: – optimistic updates – temporary client IDs – retryable request queues – keeping UI responsive while syncing in the background – avoiding tight coupling between networking and domain state

I’ve seen apps turn into a mess once these concerns start leaking everywhere.

For those who’ve built offline-first mobile apps at scale: – how do you usually structure this? – what breaks first? – what would you not do again?

I’m experimenting with my own approach, but I’m very curious how others solved this in production.



Not sure if you're open to using tools for this, but PowerSync solves those tricky things you listed (and many more you didn't list (disclaimer I'm on the team))

We also have docs for common offline-first use cases. For temporary client IDs, see https://docs.powersync.com/usage/sync-rules/client-id#postgr...

Those strategies are broadly applicable no matter the stack, PowerSync just takes care of some of the details.


Thanks, appreciate the link.

I’m mostly interested in the architectural side rather than a specific tool: how people separate domain state from transport, where optimistic state lives, and how retry / reconciliation is usually modeled without leaking everywhere.

Still useful to see how existing systems approach client IDs though.


Cool, makes sense. We still want to write a blog post about how we built powersync that will go into more detail on the points you raised.

The one thing I'll add is we found "keeping UI responsive while syncing in the background" is highly platform dependent since all platforms have their quirks, but for React Native we have a detailed blog post and code (admittedly tightly coupled to powersync, but should provide a starting point) https://www.powersync.com/blog/keep-background-apps-fresh-wi...




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

Search: