The choice of a backend depends on (too) many things, but here are some key factors you might consider before investing time to learn a backend:
- Run the backend yourself, or prefer MBaaS?
- Usage profile of the app - amount of users and typical patterns of requests per user over time?
- Budget? Also, do you wish to have a free tier for development - typically for an app in production one could have something like 10 versions in testing / development running parallel. It is nice to have the 10 ones free…
- Do you have a preference about SQL / NoSQL?
- Do you wish to have social identities (FB, Twitter, Google etc.) for user authentication?
- Offline / caching - do you wish it to be provided by the backend client libraries, or do you wish to implement it yourself?
- Do you wish to use a javascript client library or a REST API? For JS, is integration with Angular or even Ionic important?
- Search - how important is search for you (full text search especially)?
- Backend code - do you wish to run some of the code in the backend?
MBaaS will be easiest, handling most of the heavy lifting for you.
PouchDB is great and works seamlessly with CouchDB, especially when using replication to sync offline usage. CouchDB is great, my favorite NoSQL DB – I really prefer it over Mongo myself, but it seems Mongo is winning in popularity.
For #1 you have options for CouchDB;
run CouchDB in cloud, in a Docker container it is extremely easy. A $10 / month server will get you far already… But you have to manage it yourself / backups, availability, updates, scaling etc. You have to invest a lot of time to set it up securely and properly configured. Then, later some time every week to keep things running smoothly.
Since Couch has built-in users / authentication and authorization, replication and such, it is almost a full MBaaS in itself. Not so many providers for CouchDB, though. You can have Couch from Cloudant.
But the bad news with Cloudant: if you have many users, you’d better not use replication with the app, the pricing is per request, and continuous replication will be making a lot of requests.
For #5, CouchDB has excellent user management in itself, but no integration with social identities. You have to implement an FB login yourself over it.
Search is tricky… Couch has its own style. Do not expect anything to be easy like in SQL – SELECT * FROM ARTICLES WHERE OWNER LIKE 'John%'
won’t work… You have to build views and use map/reduce. Couch 2.0 will add queries like Mongo, and Cloudant already has them, I think.
So, it will be easier but it’s never full text search - not with any of these MBaaS options. For that, you need Elastic, Algolia or something else to complement your DB. In any case, more costs and headaches, so full text or fuzzy search should not be the 1st priority without a real reason…
Firebase
Optimized for real-time usage. Data is a single tree and modeling your data + queries (for me at least) need a little extra thinking to get them right. Their offline support is not meant for what you describe (so, implement offline support yourself). Pricewise, actually very cheap nowadays. Basic search / queries are possible, and seem to be performing OK. No full text search here either.
Mongo alternatives…
You can run Mongo yourself, or have it hosted, or as a part of MBaaS: Many - seems most MBaaS companies use Mongo as their DB. So did Parse – a very nice MBaaS with push messaging, analytics and all. But when FB decided to kill Parse, it scared a lot of MBaaS users; what would they do if their MBaaS was killed as well - having to rewrite the apps and transfer all the data and what not…
Something I’ve been studying myself: Kinvey - one of the promising (Mongo) MBaaS companies. They even have an Ionic starter: https://market.ionic.io/starters/kinvey-starter
Authentication, social identities, push messaging, Ionic/Angular client libraries (with offline support) etc.
Their pricing is per monthly active user, so you can use sync. If you have less than 1000 users it’s free. If you have less than 100 000 users and 30 GB of data, you pay $200 monthly. Sadly at 100 001 users or 31 GB you end up paying $2000 a month - quite a step…
Offline support seems to be getting better in their next client library but that is currently in beta. The current version has offline support, but is not that comprehensive yet.
Text searches are limited to “starts with” kind of queries, but seem to be performing OK.
With all the NoSQL databases, you have to think how to organize and save your data / denormalizing and keeping the hierarchy optimized for you usage. Still, it is easier and more flexible than SQL indexing, tables and joins…
MORE OPTIONS
If you are interested in MBaaS - there’s a collaborative list of many alternatives on Git: https://github.com/relatedcode/ParseAlternatives
OFFLINE
For #6: You might consider implementing the offline capabilities yourself in code, not syncing or using the client libraries of the backend… Avoid local storage, and be aware of the (size and stability) limitations of IndexedDB and WebSQL. IMHO, for an Ionic app, use SQLite - either directly, or via PouchDB.
Cordova/PhoneGap + SQLite Plugin: if you include this plugin in your project, then even PouchDB will automatically use that instead.
SERVER CODE
Tough one - makes a lot of sense to run some code in the cloud. Makes it easier to update functionality for existing apps, or to make them more secure as the clients do not get to write to DB directly.
Many MBaaS platforms enable you to run NodeJS code before or after DB calls, or on their own to respond to a call from the app. Parse had this, Kinvey has it. Firebase sadly does not.
HOSTING
If you have a web app, or need to serve some content for the app outside of the DB, you need hosting as well. Firebase has it, Parse had it, Kinvey sadly not.