logo

Backend as a Service: Firebase

- June 9, 2020

Photo by Akira Hojo on Unsplash

Server configuration, maintenance, and administration. Database, authentication, hosting, analytics, data caching, scaling. You don't want to implement it from scratch. Google offers a robust and advanced service called Firebase. It serves as Backend as a service (BaaS).

Firebase

Google provides Backend as a Service through its Firebase product. You delegate the hard work and you focus on designing your product.

That's it! You just skipped thousands of pitfalls. You rely on rock-solid technology that uses the most advanced techniques in the world, all of this through a free-tier plan!

Firestore

Firestore Firestore is the database of the project. It stores records of any kind. You write rules to protect confidential records. It offers real-time capabilities, data caching, pagination, sorting and ordering. All of this through a clean and well-documented API.

Storage

Firebase Storage stores various files, such as user-provided images or documents. You write rules to protect confidential files.

Functions

Firebase Functions perform logic on a secured environment (Google Cloud), rather than on the client. This allows centralizing logic into one place, and allows using admin privileges in a safe way. This is used to trigger side-effects, validate data, or interact with third party APIs. Functions can be triggered on Auth events, Firestore Events, Storage events, or HTTP requests.

For example, a function sends a welcome email to a new user when the registration is complete. The function is triggered by an Auth Event, and calls a third-party API through an outbound HTTP request. In this case, it sends a request to SendGrid. SendGrid then proceeds to send the email on your behalf. Calling the API from the client would expose the secret API key. The key is better stored in the secured Google Cloud environment.

Auth

Firebase Auth enables authentication through different providers, and offers a default interface and authentication flow if needed. It integrates well with the other firebase services.

Firebase Cloud Messaging

#Todo

Firebase Analytics

#Todo