Search⌘ K
AI Features

Introduction to Cloud Functions

Explore how to use Cloud Functions in Firebase to run back-end code automatically in response to app events or HTTPS requests. Understand the deployment process, initialization steps, and how functions scale with app usage, helping you build serverless features within your Firebase project.

Cloud Functions for Firebase is a Google Cloud product that lets us automatically run back-end code in response to events triggered either by other Firebase services or by HTTPS requests. With Cloud Functions, we can easily run server-side code without the need to set up a server. Some possible examples of this server-side code include adding roles to users, reacting to changes in a database, or notifying the user when something interesting—such as sending a welcome email when a user signs up—happens. These are events we typically won’t want to run on the client side. Therefore, a perfect use case for Cloud Functions. With the Admin SDK, we can seamlessly interact with other Firebase services from trusted environments via Cloud Functions. For example, we can create a new document in a Cloud Firestore users collection when a user signs up.

How it works

Cloud Functions for Firebase is written in a Node.js environment using either JavaScript or TypeScript. After successfully writing a function, all functions must be ...