Ask HN: Best architecture for offline-first, cloud-synced mobile app?
I've built an iOS app that uses Rails as a backend, this has worked well as a stack for me in the past, but the wrinkle is that this app now needs to be truly functional offline - I need to persist every object locally for offline use, but then also have that synced to the cloud for backup and to enable other features like sending emails and notifications containing users' content.
There are obviously plenty of straight-forward options to handle the local persistence (CoreData, SQLlite, Realm, etc.), and I'm happy to use any of them, but there seems to be no great option for persisting/syncing the local stuff on the cloud. Each of the options I've come across has significant drawbacks:
Realm Platform - prohibitively expensive (> $2000/year) if you want to access the server data to do anything other than communicate with a Realm client, also migrations are a pain
iCloud + CoreData - people might not have iCloud space or iCloud enabled
Google Cloud Firestore - in beta, some people experiencing issues with locally created objects not getting persisted, locked in to platform
Google Firebase Realtime - seems like this is effectively on the way to getting deprecated in favor of Firestore
Rolling my own solution where I write a background process to sync the client's data with my Rails server - lots of complex code, prone to bugs
Any opinions on this problem or things I should consider? Would be greatly appreciated!
7 comments
[ 3.2 ms ] story [ 27.4 ms ] threadhttps://www.mongodb.com/cloud/stitch
Another option you can investigate is AWS AppSync.
You also can just configure your data layer to get from the cache if offline, and get from your Rails app if online. You can use the Reachability framework to get notifications when an Internet connection comes back online.
AWS AppSync looks like it's worth investigating, thanks!
Agreed a custom data layer/cache might be the way to go, I think it gets a bit more complex once you have a bunch of objects being edited and deleted, and I've also spent some time with iOS background networking in the past and I know it can be buggy/frustratingly non-deterministic, which is why I'm reluctant.
2) AWS AppSync Client (not Amplify) + AWS AppSync service + Cognito + a few Lambdas + some db
https://medium.com/@btaylor/react-with-c-building-the-quip-m...