Introducing Cloud Functions for Firebase

Firebase started with the belief that apps could be built with mostly client code since it was, in many instances, easier and faster. However, there are still some cases where server code is needed, such as executing trusted code, authenticating to a third party API, or running battery intensive operations. In these instances, you had to stand up your own server —  until now.

Today we are excited to announce the beta launch of Cloud Functions for Firebase. It lets you write small pieces of JavaScript, deploy them to Google’s Cloud infrastructure, and execute them in response to events from throughout the Firebase ecosystem. This has been the most requested feature since Firebase launched. The ability to extend and connect Firebase features using Cloud Functions makes Firebase more powerful, allowing you to do even more with your app without having to think about servers.

Cloud Functions is a versatile tool for building your mobile app. Here are a just a few of the many tasks you can perform with the integrations available at launch:

Integrations

Google Analytics

The Google Analytics integration lets you trigger a function when a specific conversion event is fired. You can create functions to automate growth and retention workflows for your mobile apps, all without ever needing to update your client code.

Firebase Authentication

The Firebase Auth integration lets you trigger a function when a new user is created or deleted.

Realtime Database

The Realtime Database integration lets you trigger a function when data is created, updated, or deleted at a specific path in the database.

Cloud Storage

The Cloud Storage integration lets you trigger a function when an object is written, updated, or deleted within a particular storage bucket.

HTTP endpoint

The HTTP endpoint integration gives your Cloud Function a URL that can be used as a webhook. These functions are triggered when a request is made to their own unique, secure URLs.

We’ll continue to add more integrations in the future.

“We were early testers of Cloud Functions for Firebase and were excited to see how easy it was to extend the Realtime Database to export data and integrate with other services.” - Erling Mårtensson, Master Architect, Sony

Firebase SDK and tooling

Cloud Functions for Firebase provides a first-class experience for Firebase developers, built on top of Google Cloud Functions. Cloud Functions are single-purpose JavaScript functions that are executed in a secure, managed Node.js environment. The Firebase SDK for Cloud Functions gives you an API that allows you to choose an event source (such as writes to Firebase Realtime Database at a specific data location) and implement a function that triggers on every matching event. Our SDK also works with TypeScript to support code completion and help you catch syntax errors early.

The SDK works in tandem with the Firebase CLI to provide a seamless experience when deploying your functions. This tight integration allows you to deploy all of your functions using only a single command.

Pricing

Cloud Functions is available on all Firebase pricing plans, including our free tier. The free tier allows you to quickly experiment and try out integration with other Firebase products. For our Blaze plan, you only pay for what you use. Blaze customers also receive a monthly allotment of free usage for Cloud Functions.

“Thanks to Cloud Functions for Firebase, I built a company with no permanent employees but myself (so far), with no serious scaling concerns, and no major costs maintaining or upgrading the backend as the app grows. It’s something of a miracle.”
- Paul Budnitz, Founder/CEO, Wuu

Create and deploy your first Cloud Function today

Getting started is easy! Walk through our step-by-step codelab, which takes you through setting up your first Cloud Function. You can refer to our full documentation for all the details.

We can’t wait to see what you build!