explaingit

firebase/functions-samples

12,221JavaScriptAudience · developerComplexity · 3/5Setup · moderate

TLDR

A collection of self-contained example projects for Cloud Functions for Firebase, showing how to run serverless code in response to file uploads, database writes, user sign-ups, scheduled timers, and web requests.

Mindmap

mindmap
  root((functions-samples))
    Trigger Types
      File upload
      Database write
      User auth events
      Scheduled timer
    Use Cases
      Image processing
      Email notifications
      Payment integration
      Data sync
    Languages
      JavaScript Node.js
      Python preview
    Requirements
      Firebase project
      Blaze billing plan
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Things people build with this

USE CASE 1

Automatically generate image thumbnails or blur inappropriate content whenever a user uploads a photo to Firebase Storage.

USE CASE 2

Send a welcome email to a new user the moment they create an account via Firebase Authentication.

USE CASE 3

Keep a running count or summary in your Firebase database that updates automatically when records are added or removed.

USE CASE 4

Integrate a third-party service like Stripe or Slack into your Firebase app via a Cloud Function triggered by a database event.

Tech stack

JavaScriptPythonNode.js

Getting it running

Difficulty · moderate Time to first run · 30min

Requires a Firebase project with Blaze (pay-as-you-go) billing enabled, Cloud Functions do not deploy on the free Spark plan.

In plain English

This repository is a collection of example projects for Cloud Functions for Firebase, published by Google. Cloud Functions is a service that lets you run small pieces of code on Google's servers in response to events, without setting up or managing your own server. Firebase is Google's platform for building mobile and web applications, and Cloud Functions connects to its various services. The examples are organized by trigger type, which is the kind of event that causes a function to run. A trigger might be a user uploading a file to cloud storage, a document being written to a database, a new user account being created, an incoming web request, or a scheduled timer. Each sample shows a small, self-contained piece of code that responds to one of these triggers and does something useful with it. The sample collection covers a wide range of practical use cases. Image processing examples show how to automatically generate thumbnails, convert image formats, or blur inappropriate content when a file is uploaded. Database examples show how to keep counts up to date, delete old records automatically, or keep data in sync across different parts of Firebase. Authentication examples show how to send welcome or farewell emails when users join or leave, or validate a user's email before allowing them to sign in. Other samples cover sending notifications to mobile devices, calling external APIs, using AI models to analyze text or images, and integrating with third-party services like Slack, PayPal, and Stripe. Samples are available in both JavaScript (Node.js) and Python, and most support both the first and second generation of Cloud Functions. The README notes that Python support is currently in public preview, meaning it may still change. Deploying any of these samples requires a Firebase project with the Blaze pay-as-you-go billing plan enabled, as Cloud Functions does not run on the free tier when deployed to production. This repository is intended as a learning and reference resource, not as a ready-to-deploy application. Each subdirectory contains its own README with setup and deployment instructions for that specific example.

Copy-paste prompts

Prompt 1
Show me the Cloud Functions code for automatically generating a thumbnail when an image is uploaded to Firebase Storage, based on the firebase/functions-samples style.
Prompt 2
How do I write a Firebase Cloud Function that sends a welcome email using the functions-samples pattern when a new user signs up?
Prompt 3
Help me adapt the Stripe integration sample from firebase/functions-samples to process a payment when a Firestore order document is created.
Prompt 4
I need a Cloud Function that keeps a live count of documents in a Firestore collection, show me the code following the functions-samples pattern.
Open on GitHub → Explain another repo

← firebase on gitmyhub — every repo by this author, as a profile.

Verify against the repo before relying on details.