Firebase started out as a cloud database which grew to include notifications, authentication, and other features. At face value, it looks interesting, allowing mobile devices to load and store data using the Firebase API, eliminating the need for owning any back-end server or hosting. To keep in sync easily, it’s possible for different devices using Firebase to get events on data changes. As its native format, the database uses JSON, a good fit for a web or mobile application. Firebase supports Web, Android, and iOS. This goes to mean it supports native apps plus a website or a web-based admin component. V3, the latest version of Firebase, is now completely hosted on Google Cloud and introduced us to some nice features like the Push notifications for iOS/Android and cloud storage.
What is Firebase?
Firebase started out as a Backend-as-a-Service (BaaS) and grew into a next-generation app-development platform on Google Cloud Platform. Firebase frees you to focus on crafting amazing user experiences. You don’t need to manage servers anymore. You don’t need to write APIs anymore. Firebase can be your server, your API and your datastore, all written so generically that you can modify it to suit most of your needs. Firebase allows you to develop the whole application on the front-end without any server-side code. But, it does let you set up some server-side logic via Firebase Functions if you need to react to some events like the creation of data or files, login, https requests, etc., you can send push notifications or emails or process the data after it is written. Also, you’ll occasionally need to use certain bits of the Google Cloud for your advanced applications. Firebase won’t be everything to everybody, although it gets quite close. On the other hand, there’s a lot it doesn’t do. You need to think about Firebase in the context of your application’s architecture.
It’s Real-time Database
Firebase is a real-time database that you can communicate with directly from the client. The moment you save your JSON data to Firebase, these changes are immediately sent to all clients, of web and mobile, who requested them. Firebase will help you build modern applications faster than ever, with built-in static file hosting, user management, and security rules.
Nothing compares to real-time data. It is the way of the future. Most databases need you to make HTTP calls to get and sync your data. And these databases give you data only when you ask for it. With Firebase, when you connect your app to it, you’re not connecting through normal HTTP. You’re connecting through a WebSocket. WebSockets are a lot faster than HTTP. You won’t have to make individual WebSocket calls since one socket connection is all you need. All of your data syncs automatically through the single WebSocket as fast as your client’s network can carry it and Firebase sends you new data as and when it’s updated. When your client saves a change to the data, all clients who are connected, receive the updated data almost instantly. The Firebase real-time database provides us with the ability to save, retrieve and sync our data with our NoSQL cloud database. This data can be synced across all clients in real time. You see the Firebase real-time database is a cloud-hosted NoSQL database, where the data stored as a JSON is synchronized in real time to all connected clients. Therefore, it has different optimizations and functionalities compared to a relational database.
Using Firebase To Provide Real-Time Notifications
Firebase Notifications is a free service enabling targeted user notifications for mobile app developers. Built on Firebase Cloud Messaging (FCM) and the FCM SDK, Firebase Notifications provides an option for developers seeking a flexible notification platform which requires minimal coding effort to get started, and a graphical console for sending messages. With this, you can send notifications to all supported message targets. Firebase Cloud Messaging handles the routing and delivery to targeted devices.
The authentication. Firebase auth includes a built-in email/password authentication system. It also supports OAuth2 for Facebook, Google, Twitter and GitHub. Additionally, Firebase Auth integrates directly into Firebase Database, this way you can use it to control access to your data.
The hosting. Firebase comes with an easy-to-use hosting service for all your static files. It serves all of it from a global CDN with HTTP/2.
The real-time syncing of data across all clients, be it Android, iOS or Web will come in very handy. With minimal code, you can do a lot with this like chat boxes, live news feed, notifying users of new posts or friend requests and more.
The code for AJS is straightforward either way. From querying data to integrating Twitter, Facebook, and Google+ logins, you can have it running quite quickly with some nice features.
Via automatic update notifications, it keeps two systems synchronized, without manual messaging, WebSockets, etc.
Allows you to treat data as streams to build highly scalable applications.
You don’t require a server for a simple UI.
Limited query abilities due to Firebase’s data stream model. One of the main challenges will turn out to be the organization of data in the database. Today the Firebase Database queries are limited. Certain query options can’t be combined. Because of this, you’ll have to choose, either you order the documents by date or filter them with user’s search query on the database side and perform the other action on the client side.
Traditional relational data models are not applicable to NoSQL. Hence, your SQL chops won’t transfer.
No on-premise installation.
Firebase is very oriented towards real-time sync. The database automatically gets updated, when you type in a text field. If anyone else types in a text field, your screen adjusts. The primary documentation examples and Angular integration will seem focused on this. It might not be what you’re looking for though. You might be more comfortable with writing queries and using an event handler to update the database or receive someone else's update. But this is just a matter of adjusting a tad.
The database is surprisingly limited.
Without a back end, supporting Web, iOS, and Android means rewriting business logic and data transformation numerous times
Angular integration only helps if you’re looking for HTML widgets tied directly to database updates, with no listeners or handlers in between.
Firebase can only sort ascending, not descending.
Figure out where Firebase fits into your application. If you’re looking for a real-time news feed, Firebase does this well. If you want in site notifications, Firebase is a perfect fit. If you want a chat system, great. Are you looking to show new articles to everyone viewing the site? Firebase will work well for you. Firebase is meant for quick projects. It’s fast, easy to set up and in most cases will only require front-end logic. It lets you focus on your application instead of implementing custom authentication, web sockets or database connections. The drawback is you have to organize your application to remain as simple as possible, i.e., read and write operations without complicated business logic.
Firebase is used so extensively for real-time notification features because it is a one-stop service. Firebase offers more than just support for push notifications for Android and iOS devices. It also provides the use of its real-time database service. Firebase’s simple usage of its SDKs and easy integration draws even more developers. Nevertheless, overall, Firebase isn't a great fit for the majority of the applications we work on. Make use of the Angular integration if you've decided go all-in with Firebase, and you get access to a lot of features like being able to attach the database objects directly to your screen widgets. But for going all-in with Firebase to be attractive, your application needs to be one where real-time sync is crucial, the multi-platform client is helpful, and the data model is not especially complicated. So you see, it's just a matter of ensuring the app fits Firebase's capabilities and constraints. In this regard, I suppose all tools are alike.