Imagine that you have two months to release the Minimal Viable Product for your new startup. We all agree that there is no place for long debates whether we should choose one framework over another – or if we should build all the pieces from scratch, using new, trending and shiny technologies. The clock is ticking and we need to pick the right blocks from the start, so that we can quickly proceed with their integration.

You could use a ready, viable platform for integration and development of your mobile or web apps. One that enables you to build apps effectively, to seamlessly modify them at a short notice, and also steadily aid the growth of them in the near future.

There have been a few approaches to building such a platform. There’s one I want to show today, as I have used it extensively to solve exactly the kind of problem described above. It’s provided by Google and they call it “Firebase”.

In the beginning, Firebase was a startup brought to the daylight in 2011 and eventually developed into a highly dynamic, intuitive, and interactive platform called Backend as a Service (BaaS) in the hands of Google. Over time, because of its versatility and integration capabilities, Firebase would deservedly earn a reputation for being the “future” of mobile and web app development. Or maybe it was because Facebook shut down Parse, I can’t decide.

At the time of writing, Firebase offers you 18 services, but this post will focus on four of them. Of course, this does not mean that you should not become familiar with all of them, it’s just that we should pick a few to begin with.

Let’s sketch a scenario then: we have a couple of external web services which we need to integrate, plus one custom React application that we have written. Let’s focus on this app.

Hosting

Our React app can be easily deployed to Firebase hosting with just a couple steps:

Install the Firebase CLI tools:

npm install -g firebase-tools

Login to your Firebase account:

firebase login

Setup a new Firebase project in the current directory (this creates firebase.json):

firebase init

Deploy your Firebase project (relies on firebase.json configuration and your local project folder):

firebase deploy

With Firebase, all the static files are provided with a simple global CDN and HTTP/2 hosting service that don’t require any initial configuration.

In addition, the hosting service of Firebase makes use of Superstatic. And what’s the best, all your routine tests, the Superstatic can be locally run as a BrowserSync middleware for example.

The hosting behavior – like custom redirects, error pages, rewrites and headers – can be customized using firebase.json created by the firebase init command.

Cloud Functions

Whenever you need a backend API for your React application or endpoints for webhooks coming from external services, cloud functions kick in. Cloud functions let you run backend code automatically in response to HTTPS requests. And you can use a web framework like Express for more complex approaches.

CRON jobs needed? No problem, it’s just another type of function, one that’s triggered on a defined schedule.

Multiple external services send requests to your endpoints and you want to use their data to trigger next steps in your flow? No problem either. Aggregate all of the parts in one database location and react to every change using database triggers. You can listen for any change at a given location, e.g. onWrite, onCreate, onUpdate, onDelete.

Want more? There are also remote config triggers, authentication triggers, cloud storage triggers or even pub/sub triggers.

Need a job queuing solution? You can roll your own using Realtime Database and database events. All you need to do is to store the collection of tasks and listen for an onCreate event at the given location.

Authentication

OK, but your React app needs authentication, right? This one is also covered, Firebase Auth actually supports OAuth2 for social media platforms, such as Facebook, GitHub, Google, and Twitter.

Firebase Auth also comes with a proprietary Email and Password authentication system. Instead of writing your own authentication system, you can copy, paste, and use the Firebase OAuth2 system out of the box.

What’s more, Firebase Auth actually integrates with the Firebase Database directly. With Firebase Auth integrated with your Firebase database you will be able to authenticate, control, and manage any access to your database.

Real-time Database

I have no doubt that the future of databases lies in real-time data. If you want to retrieve and even synchronize your data, in case of traditional forms of databases, everything starts with HTTP call.

However, with Firebase, rather than being connected to a typical half-duplex data backend with HTTP, you are connected via a WebSocket. The latter offers full-duplex channel, bi-directional messaging pattern and few other advantages we can address deeply in another post.

A connection to a single WebSocket is sufficient and there would NOT be any need for making several WebSocket calls. With just one WebSocket, your entire data can be automatically synchronized and this is done at a breakneck speed, of course as long as the client’s network is able to handle it.

On top of that, once the data has been updated, Firebase will speedily transmit the updated data to you. Also, when the data is modified and saved by one client, every other connected client will be instantaneously sent the modified and saved data.

But of course all that glitters is not gold. Using Realtime Database has its cons, like limited querying, lack of aggregation and a few others. For more advanced approaches, give Firestore a shot.

Conclusion

To follow the rule of release early, release often, listen to what customers say and iterate on that you will need proper tools. Undeniably, all of that doesn’t mean that the Firebase stack is a silver bullet, but with a thoughtful approach it can offer indisputable help. Go ahead, give it a try, it might be just the piece that your application stack needs.