When to use Firebase Cloud functions?

Recently I got a question from one of the Indie makers that, when to use Firebase Cloud Functions?

This question triggered me to go deeper to understand the whole purpose and justification for using the Cloud functions. As a developer, you may be having the urge to learn any new technology just to have the feel. But as a business owner or as an Indie maker, you are not ready to take any technology until and otherwise, you see the business value in it.

So I am going dive deep to explain the purpose of Cloud functions and when to use it in real business cases. Some of the real situations are as follows,

Realtime notification

Business case

You need to send a notification to your app users when someone likes or follows him. This is one of the major use-cases for your business application to engage better with your users. The notification should be in near-realtime for giving a high-level engaging experience through the application.


You can write a cloud function that should watch a particular data change of the followers or likes. The cloud function will be triggered and send a notification to the target users based on the data change. You can have any kind of notification through cloud functions. A few examples would be, sending an email or in-app notification or push it to the Slack channel. It is up to the real need and you can solve it through cloud functions.

Data Sanitization

Business case

Data sanitization is one of the important activities to keep our application data in sync with the changes happening at any layer. I believe as a young entrepreneur or Indie makers, you already have some basic understanding of the GDPR compliance. Without this compliance, you are not allowed to do business with the European continent. In short, you should not have the user’s personal data after they deleted their account with your application.


You can write a cloud function to anonymous the user’s personal information available with your application. This cloud function should watch on the user delete operation. Whenever a user is deleted from your application, the respective callback function will handle the anonymous operation to eliminate the trace from your data set.

Off-load App Workload

Business case

It is always good that you should separate the CPU intensive tasks out of the main application. This means you should off-load the heavy workload to any other operation which should operate asynchronously without blocking the main application.

Your business app requires to generate thumbnail in different sizes from the uploaded image. So there are 3 operations involved in the whole process.

  • Upload image from your app
  • Create thumbnail in various sizes from the uploaded image
  • Store those thumbnails in the datastore for the future


You should create a cloud function to create the thumbnails in various sizes from the source image. This function should watch on image upload operation in Firebase Cloud Storage. When the image is uploaded in a specific path, then your cloud function will be automatically triggered and do the job. The newly created thumbnails can also be stored back to the Firebase Cloud Storage based on your use-case. This way you can delegate some of the heavy lifting operations to cloud functions.

External API integration

Business case

One of the key use-case for cloud function is to have the integration with external APIs and services. The business use-case is to have a Stripe payment gateway integration with your application. When someone subscribes through your application, you should create a subscription plan with a Stripe payment gateway for the future payment schedule.


To solve the above problem, you can write a cloud function that should consume the Stripe APIs to have the integration. Then the cloud function should watch on the user subscription event. Once this is tied together, the external integration will work seamlessly.

I hope this would have cleared your doubts on when to use Firebase Cloud functions. Let me know if you have any questions or feedback. Please share it with your friends if you feel this would help them as well.

{ Happy coding }

API Evangelist | Chief Hustler @workrituals.com | Habit Coach | Madras Java User Group Leader

Latest articles

Flutter: How does column layout work?

Layouts are the fundamental starting points for developing Flutter applications. There are many layout options are available by default. I am going...

Flutter: Stateless vs Stateful widgets

Flutter is a mobile application development framework developed by Google. You need to understand the fundamental building blocks before you dig deeper...

Why Flutter is a great technology for makers &...

As per the wikipedia, Flutter is an open source UI development kit created by Google. It is used to...

Why 12-Factory methodology matters to your Microservice development?

The 12-Factor application development methodology and why is it important for your microservices strategy

When to use Firebase Cloud functions?

Recently I got a question from one of the Indie makers that, when to use Firebase Cloud Functions? This...

Similar articles


Please enter your comment!
Please enter your name here