What is the difference between Cloud Functions and Firebase Functions?

There is no product called Firebase Functions.

There are three separate things:

  1. Google Cloud Functions, which allow you to run snippets of code in Google's infrastructure in response to events.
  2. Cloud Functions for Firebase, which triggers Google Cloud Functions based on events in Firebase (such as database or file writes, user creation, etc)
  3. Firebase SDK for Cloud Functions, which includes a library (confusingly called firebase-functions) that you use in your Functions code to access Firebase data (such as the snapshot of the data that was written to the database)

So Firebase provides a (relatively thin) wrapper around Google Cloud Functions, to make the latter product easier to use and integrate it with Firebase. In that senses it is similar to how Firebase integrates Google Cloud Storage into "Cloud Storage for Firebase" (formerly known as Firebase Storage).

If you're using Google Cloud Platform without Firebase, then you should use plain Google Cloud Functions. If you're on Firebase or if you're a mobile developer interested in Cloud Functions, you should use Cloud Functions for Firebase.


There is an additional difference: Firebase Functions can only be implemented in JS or Node.JS, while Cloud Functions also allow the use of Python and Go.

There is also a small difference in terms of how they are priced, if you are on the Spark Plan. Check this out https://firebase.google.com/pricing vs. https://cloud.google.com/functions/pricing if you are on the Blaze plan, the pricing is the same.

I happen to use both for my Firebase project.


Google Cloud Platform, GCP, has an article addressing this question, Google Cloud Functions and Firebase.

Google Cloud Functions and Firebase

Google Cloud Functions is Google's serverless compute solution for creating event-driven applications. It is a joint product between the Google Cloud Platform team and the Firebase team.

For Google Cloud Platform developers, Cloud Functions serve as a connective layer allowing you to weave logic between Google Cloud Platform (GCP) services by listening for and responding to events.

For Firebase developers, Cloud Functions for Firebase provides a way to extend the behavior of Firebase and integrate Firebase features through the addition of server-side code.

Both solutions provide fast and reliable execution of functions in a fully managed environment where there's no need for you to worry about managing any servers or provisioning any infrastructure.

...

Cloud Functions for Firebase is optimized for Firebase developers:

  • Firebase SDK to configure your functions through code
  • Integrated with Firebase Console and Firebase CLI
  • The same triggers as Google Cloud Functions, plus Firebase Realtime Database, Firebase Authentication, and Firebase Analytics triggers