Question about offline app sync database

Hi all, i going to build an app that need to support for the offline state.

I did some research on the couchdb and pouchdb, but i don’t really know which one should i go to.

I planning to use the $http communicate with remote mysql database using php.

I plan to populate the sqlite database from remote mysql also. (Couchdb or Pouchdb able to replace sqlite ?)

What should i apply in this scenario ? or any other better solutions ? thanks.

i used pouchdb for a little test app. It works and looks good. And provides sync-methods out of the box.
http://pouchdb.com/getting-started.html#basic_two_way_sync

And it works together in the main parts with sqlite plugin. (search for cordova or sqlite)
http://pouchdb.com/adapters.html

1 Like

So is that okay if i used mysql as remote database and communicate with php using http protocol ?

yep it should be possible

So if i’m used the pouchdb, it will also auto populate the database right ?

Besides that, before this i’m used localStorage to some data like logged in user.

Should i store to couchdb now ? because i saw that ios deploy need to register with cloud ?

Thanks for your reply.

yeah but for so simple flags you would use the localstorage.

Okay, appreciate for your reply. :grinning:

Other alternative: LokiJS (very fast performance, supposedly, because it’s doing most of its stuff in-memory)

http://gonehybrid.com/how-to-use-lokijs-for-local-storage-in-your-ionic-app/
http://levvel.io/blog/blog-post/offline-data-in-the-browser/

1 Like

Thanks for your suggestion, will look into it.

LokiJS seems like a really good SQLite alternative, i am just trying to rewriting some app with it.
You can choose where to persist data on localStorage or on filesystem, there is also changes API if you need to sync and dynamic view filter are really nice.

Really cool, for now I’m just sticking with Firebase and some VERY limited usage of local storage but going forward I may want to have a serious look at this.