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).
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 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.
Firebase Storage stores various files, such as user-provided images or documents. You write rules to protect confidential files.
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.
Broadly speaking, Firebase functions offer the capabilities of a server. They are highly available. They respond to requests. You can create routes. You can create a RESTful API and offer CRUD operations.
ExpressJS integration is very simple. You offer different routes through one unique function. This helps to fight against cold starts. Express enables using middlewares. Express lets you reuse pre-existing server code.
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