DB solution for hybrid-mobile-app DB solution for hybrid-mobile-app sqlite sqlite

DB solution for hybrid-mobile-app


You should also know that localStorage isn't a viable option for permanent device storage if you're going to build for iOS. The OS will wipe out localStorage data when device memory is low. IndexDB may be volatile too because it's stored within the context of the webview.

I develop an Ionic app which has some data stored (not a large amount at the moment) in SQLite. I chose localForage with SQLite driver. It works well for what I need because it stores the data to a database file in the filesystem which is safe from OS deletion. What's nice is that the functions are similar to what you get with localStorage; the biggest difference being that the functions use promises.

This is the stack of components that I used in order to implement what I have now:

Bower components

  • angular-localForage
  • localforage
  • localForage-cordovaSQLiteDriver

You will also need the Cordova-sqlite-storage plugin.


You may also have a look at LokiJS and PouchDB (blog articles from "GoneHybrid", implementing those 2 libs).

I would personally go for LokiJS (http://lokijs.org/) and its JSON file, even if both have adapters for WebSQL, SQLite, IndexedDB.


I was part of a team that built a successful Cordova / Sencha Touch (the UI framework doesn't really matter here) / SQLite app for iOS and Android. We had over 100Mb of data to store in the database, had to encrypt it and transfer it from a server into the app.

SQLite performed well, we also used some custom functions that we wrote to move some of the data crunching we needed into the database engine and out of Javascript.

Another member of the team wrote a short blog article about some of our experiences with this stack.

Overall given my experience, I'd say SQLite is a sound choice, but I don't have experience with IndexDB.