What is Firebase?
Firebase is a backend platform developed by Google on the Google Cloud Platform and can be used as the backend for projects. It is a NoSQL document database that lets you easily store, sync, and query data for your mobile and web apps.
Cloud Firestore
The Cloud Firestore is the newest version of Firebase to be released. It stores data using nested documents and collections which makes it easily scalable. It is also much easier to parse through as the data is nested within collections and documents and you are allowed to chain filters.
Reasons to use firebase:
Serverless architecture
Firebase can act as your backend without having to interact with a server. It provides data sync, authentication services, data analytics, and other features that can help mutate or make additional calls.
Syncing up the front and back end:
In Rails, the front end speaks to the back end by running the rails server and configuring routes and specific endpoints for the configured actions. For Firebase, the only thing that is needed to make calls is to grab the Firebase Project config and paste it into a firebase.js.
Data Sync:
In Rails, models have to be generated, relations need to be created, and the server needs to be run. In Firebase, the tables and entries are all dynamically created. Whatever you are passing to the database will be written. The only exception would be something generated in firebase like a timestamp.
Triggers:
Firebase has a functionality called Triggers. Triggers provide 4 event handlers, onWrite, onCreate, onUpdate, and onDelete, which allow any additional API calls on CRUD actions in the backend.
Authentication:
Authentication is simple to enable in your project with Firebase. The platform allows users to enable authentication through several high profile sites which include Gmail, Github, Apple, Twitter, Facebook, and more.
In addition, Firebase allows the ability to enable persistence through it’s configuration setup in your code. The two settings that can be enabled are local, which allows for persistence until the user explicitly signs out, or session, which allows login to continue until the window or tab is closed.
Cloud Based:
It’s been said before, but Firebase lives on the cloud. If there are multiple people working on the project, there is a centralized place to store seed data. This removes the time needed for closing and restarting the backend server and having to reseed any data.