šŸ  yamankatby

What are Firebase Extensions? How can they speed up your app development?

What are Firebase Extensions? How can they speed up your app development?

Firebase Extensions are pre-built integrations that you can add to your Firebase project with a few clicks.

Introduction

In this post, we'll try to answer the two questions we asked in the title:

  • What are Firebase Extensions?
  • How can they speed up your app development?

Next, we'll go over some of the extensions that are currently out there and see why and how they can be used.

But before that, it might be worth taking a quick look at the Cloud Functions as they are the basis of the Firebase extensions.

Cloud Functions for Firebase

Cloud Functions are a serverless solution that allows you to run backend code in response to HTTPS requests or even more āš” powerfully, in response to events triggered by other Firebase products.

For example, you can write a Cloud Function that is triggered automatically every time a new user signs up in your Firebase Authentication, every time a new document is added to your Firestore database, or every time a new file is uploaded to your Cloud Storage.

Which means that with just a few lines of code, you can extend the functionality of built-in Firebase products to implement your very specific business logic such as sending a welcome email when a new user signs up, or sending a notification to the user when a new file is uploaded to Cloud Storage.

What are Firebase Extensions?

Firebase Extensions are pre-built and well-tested Cloud Functions that make it easy to extend Firebase products functionality and integrate with other Google Cloud Platform services and third-party APIs.

They can be installed with a few clicks from the Firebase console and can be configured to fit your needs.

Currently, you can divide existing Firebase Extensions into two main categories:

Extensions built and maintained by Firebase team

This category includes various utility extensions created to extend different Firebase products such as Authentication and Cloud Firestore by implementing solutions for common missing scenarios.

It also includes some extensions that integrate Firebase with Google Cloud Platform services such as BigQuery.

Here are some of the most useful examples:

Firebase Official Extensions

Trigger Email

This extension allows you to compose and send emails whenever a new document is added to a Firestore collection that you specify. The content of the email can be fully customized based on the data of that document.

Resize Images

This extension allows you to automatically resize images that are uploaded to Cloud Storage. You can specify the maximum width and height of the resized image and the extension will automatically resize the image to fit the specified dimensions.

Stream Collections to BigQuery

This extension allows you to stream data from your Firestore collections to BigQuery tables. This is useful if you want to analyze your data using BigQuery.

Extensions built by third-party services in partnership with Firebase.

This category includes extensions that integrate Firebase products with third-party services and APIs such as Stripe, Algolia, and Mailchimp.

Firebase Third-Party Extensions

Run Payments with Stripe

This extension syncs customersā€™ subscription status with your Cloud Firestore and adds custom claims using Firebase Authentication for convenient access control in your application.

Search with Algolia

This extension listens to changes in your Cloud Firestore specified collection and automatically updates your Algolia index.

Manage Marketing with Mailchimp

This extension syncs your Firebase Authentication users with your Mailchimp audience.

How to use Firebase Extensions in your project?

The Firebase team has announced a new website called extensions.dev where you can browse extensions and add them to your project with a few clicks.

Find the extension you want to add to your project and click on the "Install" button. Then, you'll be asked to choose the Firebase project you want to add the extension to.

To use Firebase Extensions, your Firebase project must be on the Blaze (pay-as-you-go) plan.

Next, you'll be asked to configure the extension. The configuration options depend on the extension you're installing. For example, the "Resize Images" extension will ask you to specify the maximum width and height of the resized image.

After you've configured the extension, click on the "Install" button and you're done!