

Ask HN: Mobile app that works offline and syncs data periodically - saurabhnanda

At our startup, our target market is increasingly conducting their business, on-the-go. Therefore, we have to augment our browser-based desktop app with a mobile app.<p>Therefore, I&#x27;m now evaluating what it would take to develop a mobile app that could work completely offline and sync transaction data periodically with the central server.<p>I&#x27;ve read briefly about Firebase, Parse, Usergrid, BaasBox, master-master replication, and the CAP theorem. As expected, I&#x27;m royally confused now!<p>We&#x27;ve already built out or backend using Postgres and RoR. Ideally I&#x27;d like to stick to it, especially Postgres, as we&#x27;re dealing with financial transactions. We already have HTTP&#x2F;JSON APIs to read&#x2F;write data. We can also develop fine-grained APIs using Thrift, if required.<p>Now, my question is, is there a project&#x2F;service&#x2F;SDK out there which has already solved this data sync problem? What about conflict resolution when it comes to transaction data? I understand that this is like resolving merge conflicts in git, which basically requires human intervention, but is there an SDK that will reduce dev time for such scenarios? Can said SDK work with a custom backend API?
======
ProblemFactory
I have been looking for tools to solve the same problem for a while now.

Based on documentation, the most promising approach seems to be to use
Couchbase Mobile/Lite in the app, Couchbase Server on the server, and link
them up with their sync gateway:
[http://developer.couchbase.com/mobile/develop/guides/sync-
ga...](http://developer.couchbase.com/mobile/develop/guides/sync-
gateway/index.html)

It seems that this should make it possible to save data both on the client and
server side, and leave sync and replication to the databases themselves.

Now, I haven't actually adopted it yet for two reasons:

* My server stack is built on top of Postgresql and Django, so I would need to either rip out Postgres and go all-in with Couchbase, or somehow sync between Postgres and Couchbase on the server, and

* Authentication, authorization and data access filtering has to be implemented as custom Javascript plugins in the sync gateway, so I would have to rewrite most of my server-side app logic. By default the clients have full write access to the server database...

But if you do give this a try, I would really like to hear about your
experience.

