Firebase Extensions

Firebase Extensions are pre-built packages that add common functionality to your Firebase project without writing custom code. Each extension is a ready-made Cloud Function that connects Firebase services to third-party tools or automates a common task. Install an extension, configure it, and it runs automatically.

What Extensions Provide

Extensions save development time by handling common backend tasks that almost every app needs:

  • Resize uploaded images automatically when files land in Cloud Storage
  • Send transactional emails via SendGrid or Mailgun when Firestore documents are created
  • Sync Firestore data to Algolia for full-text search
  • Delete a user's Firestore data automatically when their account is deleted
  • Translate text in Firestore documents using Google Translate
  • Trigger Stripe payments when Firestore checkout sessions are created
  • Export Firestore data to BigQuery for analytics

Installing an Extension

Go to the Firebase Console and click Extensions in the left sidebar. Click Explore extensions to browse the catalog. Each extension shows what it does, what Firebase services it uses, and what it costs to run.

Click an extension to see its detail page, then click Install in console. Firebase walks you through a four-step setup:

  1. Review the required services and billing impact
  2. Grant the extension the necessary IAM permissions
  3. Configure the extension parameters (API keys, collection names, settings)
  4. Click Install extension

Example: Resize Images Extension

The "Resize Images" extension automatically creates thumbnail versions of images uploaded to Cloud Storage. This is useful for profile photos, product images, or any content where you need multiple sizes.

Configuration parameters:

Cloud Storage bucket:    your-project.appspot.com
Path of source images:   uploads/
Sizes of resized images: 200x200,400x400
Deletion of original:    No
Output image format:     Same as input

After installation, every image uploaded to the uploads/ folder automatically generates 200x200 and 400x400 thumbnails in a uploads/thumbs/ folder. No code required.

Example: Delete User Data Extension

The "Delete User Data" extension automatically removes all of a user's data from Firestore, Realtime Database, and Storage when their Firebase Auth account is deleted. This helps with GDPR and privacy compliance.

Configuration:

Firestore paths: users/{UID},posts/{UID},orders/{UID}
Realtime DB paths: users/{UID}
Cloud Storage paths: profile-photos/{UID}

When any user account is deleted (manually, by the user, or by an admin), the extension automatically deletes data at all configured paths. The {UID} placeholder is replaced with the deleted user's actual UID.

Managing Installed Extensions

View and manage installed extensions under Extensions in the Firebase Console. For each installed extension, you can:

  • View execution logs
  • Update to a newer version of the extension
  • Reconfigure parameters without reinstalling
  • Uninstall the extension

Installing Extensions via CLI

# Install the Resize Images extension via CLI
firebase ext:install storage-resize-images --project=your-project-id

The CLI prompts for configuration values interactively. Store the configuration in extensions/ folder for version control:

firebase ext:export   # export current extension configs
firebase ext:install  # reinstall from exported config

Building Custom Extensions

You can publish your own private extensions for reuse across multiple Firebase projects. Extensions are defined using a manifest file (extension.yaml) that describes the Cloud Functions, required permissions, configuration parameters, and lifecycle hooks.

# extension.yaml structure
name: my-custom-extension
version: 0.1.0
description: Sends a welcome email when a new user registers

params:
  - param: SENDGRID_API_KEY
    label: SendGrid API Key
    type: secret

resources:
  - name: sendWelcomeEmail
    type: firebaseextensions.v1beta.function
    properties:
      eventTrigger:
        eventType: providers/firebase.auth/eventTypes/user.create

Key Takeaway

Firebase Extensions install pre-built backend functionality without custom code. Browse the extensions catalog in the console, configure parameters during installation, and the extension runs automatically. Popular extensions cover image resizing, email sending, data deletion, search indexing, and payment processing. Use extensions for common tasks so your team focuses development time on the features unique to your app.

Leave a Comment

Your email address will not be published. Required fields are marked *