Reuse a project's Extensions configuration

After you've installed and configured extensions in a Firebase project, you can save your configuration and deploy it to another project. Your saved configuration has information on every extension instance you've installed, including the versions of each instance and the parameter values you specified when you installed them.

This has several possible uses:

  • Recreate a project's Extensions configuration in other projects
  • Share your Extensions configuration with others
  • Commit your Extensions configuration to source control
  • Add your Extensions to your CI/CD pipeline

Save a project's Extensions configuration

To save a project's Extensions configuration, do the following:

  1. If you haven't already done so, set up the Firebase CLI
  2. From a shell prompt, change to the project directory. (Your project directory contains the file firebase.json).
  3. Run the ext:export command:
    firebase ext:export –-project=YOUR_PROJECT_ID

The ext:export command will add an extensions section to the firebase.json file. For example:

 "extensions": {
   "my-bigquery-extension": "firebase/firestore-bigquery-export@^0.1.18",
   "my-image-resizer": "firebase/storage-resize-images@^0.1.22",

Additionally, the ext:export command creates an extensions directory containing an .env file for each extension instance you've installed. These files contain the configuration parameters for each instance. For example, an instance of the storage-resize-images might have an .env file like the following:


Deploy an Extensions configuration to a project

After you've saved a project's Extensions configuration, you can deploy it to a project using the Firebase CLI. When you deploy an Extensions configuration, you install, update, and configure all of the extension instances in a saved configuration into a project at once.

To deploy an Extensions configuration:

  1. From a shell prompt, change to the directory that contains the saved Extensions configuration. (This is the directory that contains firebase.json. If you just ran ext:export, you're already in the right directory.)
  2. Run the deploy command, specifying the project to which you want to deploy the extensions:
    firebase deploy --only extensions –-project=YOUR_PROJECT_ID

The deploy command will validate each instance configuration, ask if you want to delete any extension instances from your destination project that are not listed in firebase.json, and then deploy all of your extension instances.

Project Specific Extension Configurations

Saved Extensions configurations can be used to deploy to multiple different projects - for example, a staging project and a production project. When doing this, some param values may need to be different for each project. Project specific .env files make this possible. Param values that are different between projects can be put in extensions/${extensionInstanceId}.env.${projectIdOrAlias} and shared param values can be put in extensions/${extensionInstanceId}.env.