Firebase Database as backend for your Android/iOS app

Firebase Database is a free backend infrastructure product, provided by Google, that serves as a backend for your mobile app. It can store an unlimited amount of unstructured data, that can be queried in real-time by mobile apps with only a few lines of code, due to the powerful SDKs provided by Google.

firebase server ios app templates swift

Any mobile app that relies on dynamic data needs a backend database, to store that data. For a shopping app, you would need to store your products, orders (customers and shipping addresses), payments, and product details. For a social media app, you would need to store all the content created by users (posts, comments, likes, etc). For a news reader app, you’d need a database to store your articles, comments, etc. You get the point.

The things get even more difficult because storing that data is not enough. You also need a way of serving the data in the database to the web or mobile clients (iOS/Android/Web apps). Not even this is enough though: you also need a way of keeping the clients in sync, up to date, with all the changes in your database (a.k.a real-time updates).

Achieving all of this requires a solid software infrastructure, that will take a very long time to build, and also could cost tens of thousands of dollars. This is where Firebase Database comes into play.

Firebase Database is a free backend infrastructure product, provided by Google, that serves as a backend for your mobile app. Its usability and scalability make it very powerful, and it should be the first server choice for someone trying to build an Android/iOS mobile app, especially for someone who doesn’t want to spend months and thousands of dollars for it. By adopting Firebase Database, you’ll take advantage of all its amazing features:

Data storage

The data in Firebase is being stored in JSON format. This is the universal HTTP data transfer format, used by all the mobile apps out there. Your data can have any structure you want. This is very convenient because it makes it very easy to import data from anywhere, be it from your WooCommerce online store, your WordPress MySQL database or your Excel spreadsheet. All you need to do is import a .json file in the Google Firebase dashboard. Here’s an example of how the data for our Firebase iOS Shopping App template is being stored:

firebase database swift ios mobile app

Firebase Database iOS/Android SDKs

This is by far the most powerful feature – integration with Swift and Java, for iOS and Android codebases. Google provides SDKs for all mobile clients. This basically means that you’ll fetch this data into your mobile app with only a few lines of code. This just saved you a few weeks of work, since it does everything for you: networking, API management, JSON parsing, performance analytics, etc. Here’s how easy we are querying the e-commerce products from the database pictured above:

firebase database shopping products fetch json ios swift 4 code

Bidirectional real-time updates

Not only the SDKs provide your classes and methods to easily fetch the data from the Firebase server, but it also provides you ways of writing and updating the data on your server, from the mobile app. This means that you can easily store anything you want (users, payments, orders, articles, comments, etc), by simply calling one of the APIs provided in the free Swift SDK.

Scalability and Security

Firebase is based on top of the enormous cloud computing infrastructure at Google. If there’s something Google knows how to do, is this: scalability. You can add millions of entries into your database, your app’s performance won’t decline (please make sure you paginate though :). Obviously, the whole communication between clients and server is being done through secure channels.

In conclusion, if you’ll ever think about building a mobile app, you should consider Firebase to be your backend server. Not only it’s free and saves you a lot of development time, but it also takes advantage of Google’s scalable and secure infrastructure. It’s hard to imagine you can create a more secure server that scales better than Google.

Leave a Reply

Your email address will not be published. Required fields are marked *