Skip to content

Firebase Functions

Gregorio Palamà edited this page Mar 14, 2024 · 6 revisions

Firebase Functions are used to handle events in a serverless way and to prevent Vendor Lock-in, implementing a Rest API that exposes the Firebase's services we use.

Why we use Firebase Functions

The whole project is based on Firebase. We use Firestore to store informations about the website's page, about the conference's sessions, about the speakers, etc. We use Firebase Auth to allow users to login using their Google or Apple or Facebook (and other providers) account. There are events that can happen, that can lead to some operations that must be done. For example, upon a new user's registration, we need to create a document in Firestore, so we can keep informations on that user and organize them in a GDPR compliant way. This will allow us to easily delete datas when a user requests so.

Firebase Functions' Triggers allow us to fire the execution of our Business Logic when an event occurs, giving us an event-driven capability together with a serverless implementation.

An other important reason why we use Firebase Functions is to encapsulate Business Logic and Platform specific implementations. Hedwig will generate a static version of the site when a Devfest Organizer requests a new deploy. This will trigger a build that will collect informations from a Rest API, in order to generate the static version to deploy. A Devfest Organizer will be able to add/edit contents or to operate on registered users, and these operations must be protected: Hedwig will check that the user performing them has the right claims. For these Use Cases, we want to expose an API, instead of directly depending onto Firebase implementations: the API layer will prevent the vendor lock-in and allow whoever to easily adapt the software to different Platforms.

Project structure

Libraries used