Code360 powered by Coding Ninjas X Code360 powered by Coding Ninjas X
Table of contents
Cloud Functions for Firebase
Key capabilities
How does it work?
Implementation path
Firebase Extensions
Key capabilities
How does it work?
Implementation path
Frequently Asked Questions
What are Cloud Functions in Firebase?
Is Cloud Functions free in Firebase?
Can I store files in Firebase?
Last Updated: Mar 27, 2024

Cloud Functions and Extensions in Firebase

Master Python: Predicting weather forecasts
Ashwin Goyal
Product Manager @


Let's ensure we understand the foundational concepts before delving further into the subjects. Here is a brief introduction if you are unfamiliar with Google Cloud Functions. 

Cloud Functions and Extensions in Firebase

A serverless execution environment for constructing and linking cloud services is called Google Cloud Functions. You can create straightforward, one-purpose functions with Cloud Functions that are linked to events released by your cloud infrastructure and services.     

This article explains the details of Cloud Functions for Firebase and Firebase Extension, in which we talk about how it works, its key capabilities, and its implementation path.

Without further ado, let's get started.

Cloud Functions for Firebase

Cloud Functions for Firebase is a serverless framework that enables you to automatically execute backend code in response to events brought on by Firebase features and HTTPS requests. Your JavaScript or TypeScript code is run in a controlled environment and is stored in Google's Cloud. You don't have to scale and manage your servers.

Key capabilities


How does it work?

💁 Google's servers manage a function as soon as you build and deploy it. If the function is a background, Google's servers will monitor events and perform the function when triggered. Alternatively, you can call the function directly with an HTTP request.

Google adjusts the number of virtual server instances required to run your function quickly as the load rises or falls. Each function operates independently, with its setup and environment.

📁 Lifecycle of a background function

1️⃣ You create a new function by writing code, choosing an event source (such as Cloud Firestore), and specifying the circumstances under which the function should run.

2️⃣ When executing your function:

a. Before Cloud Functions generates an Artifact Registry repository (called gcf-artifacts) in your project, the Firebase CLI creates archive containing the function code, which is then uploaded to a Cloud Storage bucket (prefixed with gcf-sources).

b. The function source is built using Cloud Build when the function code has been retrieved. In the Google Cloud Console, you may see Cloud Build logs.

c. Your new function is released after the container image for the code of the created functions is published to a private Artifact Registry repository in your project (called gcf-artifacts).

3️⃣ The function is called when the event generator creates an event that satisfies its requirements.

4️⃣ To handle tasks more quickly when a function is busy with many events, Google launches extra instances. Instances are cleaned up when a function is idle.

5️⃣ Instances for earlier versions are removed from the Artifact Registry and build artifacts when you update a function by deploying updated code. New instances are then created in their stead.

6️⃣ All instances and zip archives are deleted along with any associated build artefacts in the Artifact Registry when a function is deleted. The event provider and the function are no longer linked.

Implementation path

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job

Firebase Extensions

With pre-packaged solutions, Firebase Extensions make it easy to quickly add functionality to your project.

Once deployed, a Firebase Extension responds to HTTPS requests, Cloud Scheduler events, or triggering events from other Firebase products, such as Cloud Firestore or Firebase Cloud Messaging, by carrying out a given job or collection of tasks.

Key capabilities


How does it work?

💁 A Firebase Extension is a piece of code that does a job each time an app- or project-specific event takes place.

Cloud Functions for Firebase are used to create the logic for an extension. An extension's functions specify the event providers and the circumstances under which they are executed (for example, a Cloud Firestore write, an HTTPS request, or a Cloud Scheduler event).

Extensions make use of functions. However, one essential fact between extensions and functions is that an extension relies upon an extension.yaml specification file, which explicitly defines:

✔️ The extension will utilise Google services (APIs).

✔️ Access rights are necessary for the extension to function.

✔️ The resources are unique to the extension that it needs to function.

✔️ The options for the extension's configurable parameters.

An extension may be installed more than once in a project, with each installation having a unique configuration.

📁 Firebase does the following actions when you install an instance of an extension:

1️⃣ You are prompted to enter the configuration values (parameters) for this particular extension instance.

2️⃣ Enables the project's extension.yaml file's listed APIs.

3️⃣ Assigns the listed access roles to a brand-new service account that will be utilised by this instance of the extension. The extension instance uses the access granted to this service account to run its code.

4️⃣ Gives the extension instance the listed resources (for example, a function).


Keep in mind that every extension instance that is installed has its service account and resources that are supplied specifically for it.

Implementation path


Frequently Asked Questions

What are Cloud Functions in Firebase?

Using the serverless framework Cloud Functions for Firebase, you may have backend code run automatically in response to events brought on by Firebase features and HTTPS requests.

Is Cloud Functions free in Firebase?

Thanks to its perpetual free tier for invocations, you can try out the platform for free using Cloud Functions. Please be aware that we demand a valid billing account even for free tier usage.

Can I store files in Firebase?

Maintain order using collections. Organize and save stuff according to your preferences. You can quickly and easily upload files using Cloud Storage for Firebase to a Cloud Storage bucket that Firebase provides and manages.


Congratulations on finishing the blog! We have discussed the details of Cloud Functions for Firebase and Firebase Extension in which we talk about how it works, the Key capabilities, and their implementation path.

We hope this blog has helped you enhance your knowledge of Cloud Functions and Extensions in Firebase. If you'd like to learn more, Check out the following links:

🔥 Firebase: Its features and usage

🔥 Load Balancing in Cloud

🔥 Cloud DNS


Please refer to our guided pathways on Code studio to learn more about DSACompetitive ProgrammingJavaScriptSystem Design, etc. Enroll in our courses, and use the accessible sample exams and questions as a guide. For placement preparations, look at the interview experiences and interview package.

Please upvote 🏆 our blogs 🎈 if you find them helpful and informative!

Happy coding🤗

Previous article
Interacting with a Firebase Project
Next article
Firebase Realtime Database v/s Cloud Firestore
Live masterclass