The Firebase CLI (GitHub) provides a variety of tools for managing, viewing, and deploying to Firebase projects.
Before using the Firebase CLI, set up a Firebase project.
Set up or update the CLI
Install the Firebase CLI
You can install the Firebase CLI using a method that matches your operating
system, experience level, and/or use case. Regardless of how you install the
CLI, you have access to the same functionality and the firebase command.
Windows
You can install the Firebase CLI for Windows using one of the following options:
| Option | Description | Recommended for... |
|---|---|---|
| standalone binary | Download the standalone binary for the CLI. Then, you can access
the executable to open a shell where you can run the
firebase command.
|
New developers Developers not using or unfamiliar with Node.js |
| npm | Use npm (the Node Package Manager) to install the CLI and enable
the globally available firebase command.
|
Developers using Node.js |
standalone binary
To download and run the binary for the Firebase CLI, follow these steps:
Download the Firebase CLI binary for Windows.
Access the binary to open a shell where you can run the
firebasecommand.Continue to log in and test the CLI.
npm
To use npm (the Node Package Manager) to install the
Firebase CLI, follow these steps:
Install Node.js using nvm-windows (the Node Version Manager). Installing Node.js automatically installs the
npmcommand tools.Install the Firebase CLI via
npmby running the following command:npm install -g firebase-tools
This command enables the globally available
firebasecommand.Continue to log in and test the CLI.
macOS or Linux
You can install the Firebase CLI for macOS or Linux using one of the following options:
| Option | Description | Recommended for... |
|---|---|---|
| automatic install script | Run a single command that automatically detects your operating system,
downloads the latest CLI release, then enables the globally available
firebase command.
|
New developers Developers not using or unfamiliar with Node.js Automated deploys in a CI/CD environment |
| standalone binary | Download the standalone binary for the CLI. Then, you can configure and run the binary to suit your workflow. | Fully customizable workflows using the CLI |
| npm | Use npm (the Node Package Manager) to install the CLI and enable
the globally available firebase command.
|
Developers using Node.js |
auto install script
To install the Firebase CLI using the automatic install script, follow these steps:
Run the following cURL command:
curl -sL https://firebase.tools | bash
This script automatically detects your operating system, downloads the latest Firebase CLI release, then enables the globally available
firebasecommand.Continue to log in and test the CLI.
For more examples and details about the automatic install script, refer to the script's source code at firebase.tools.
standalone binary
To download and run the binary for the Firebase CLI that's specific for your OS, follow these steps:
(Optional) Set up the globally available
firebasecommand.- Make the binary executable by running
chmod +x ./firebase_tools. - Add the binary's path to your PATH.
- Make the binary executable by running
Continue to log in and test the CLI.
npm
To use npm (the Node Package Manager) to install the Firebase CLI,
follow these steps:
Install Node.js using nvm (the Node Version Manager).
Installing Node.js automatically installs thenpmcommand tools.Install the Firebase CLI via
npmby running the following command:npm install -g firebase-tools
This command enables the globally available
firebasecommand.Continue to log in and test the CLI.
Log in and test the Firebase CLI
After installing the CLI, you must authenticate. Then you can confirm authentication by listing your Firebase projects.
Log into Firebase using your Google account by running the following command:
firebase login
This command connects your local machine to Firebase and grants you access to your Firebase projects.
Test that the CLI is properly installed and accessing your account by listing your Firebase projects. Run the following command:
firebase projects:list
The displayed list should be the same as the Firebase projects listed in the Firebase console.
Update to the latest CLI version
Generally, you want to use the most up-to-date Firebase CLI version.
How you update the CLI version depends on your operating system and how you installed the CLI.
Windows
- standalone binary: Download the new version, then replace it on your system
- npm: Run
npm install -g firebase-tools
macOS
automatic install script: Run
curl -sL https://firebase.tools | upgrade=true bashstandalone binary: Download the new version, then replace it on your system
npm: Run
npm install -g firebase-tools
Linux
automatic install script: Run
curl -sL https://firebase.tools | upgrade=true bashstandalone binary: Download the new version, then replace it on your system
npm: Run
npm install -g firebase-tools
Uninstall the Firebase CLI
How you uninstall the CLI depends on your operating system and how you installed the CLI.
Windows
- standalone binary: Delete the
firebase.exebinary that you downloaded. - npm: Run
npm uninstall -g firebase-tools
macOS
automatic install script: Run
curl -sL https://firebase.tools | uninstall=true bashstandalone binary: Delete the
firebasebinary that you downloaded. If you added its location to yourPATHenvironment variable, be sure to remove it.npm: Run
npm uninstall -g firebase-tools
Linux
automatic install script: Run
curl -sL https://firebase.tools | uninstall=true bashstandalone binary: Delete the
firebasebinary that you downloaded. If you added its location to yourPATHenvironment variable, be sure to remove it.npm: Run
npm uninstall -g firebase-tools
Use the CLI with CI systems
We recommend that you authenticate using Application Default Credentials when using the CLI with CI systems.
(Recommended) Use Application Default Credentials
The Firebase CLI will detect and use Application Default Credentials if they're set. The simplest way to authenticate the CLI in CI and other headless environments is to set up Application Default Credentials.
(Legacy) Use FIREBASE_TOKEN
Alternatively, you can authenticate using FIREBASE_TOKEN. This is less secure
than Application Default Credentials and is no longer recommended.
On a machine with a browser, install the Firebase CLI.
Start the signin process by running the following command:
firebase login:ci
Visit the URL provided, then log in using a Google account.
Print a new refresh token. The current CLI session will not be affected.
Store the output token in a secure but accessible way in your CI system.
Use this token when running
firebasecommands. You can use either of the following two options:Option 1: Store the token as the environment variable
FIREBASE_TOKEN. Your system will automatically use the token.Option 2: Run all
firebasecommands with the--token TOKENflag in your CI system.
This is the order of precedence for token loading: flag, environment variable, desired Firebase project.
Initialize a Firebase project
Many common tasks performed using the CLI, such as deploying to a Firebase
project, require a project directory. You establish a project directory
using the firebase init command. A project directory is usually the same
directory as your source control root, and after running firebase init, the
directory contains a firebase.json configuration
file.
To initialize a new Firebase project, run the following command from within your app's directory:
firebase init
The firebase init command steps you through setting up your project directory
and some Firebase products. During project initialization, the Firebase CLI
asks you to complete the following tasks:
Select a default Firebase project.
This step associates the current project directory with a Firebase project so that project-specific commands (like
firebase deploy) run against the appropriate Firebase project.It's also possible to associate multiple Firebase projects (such as a staging project and a production project) with the same project directory.
Select Firebase products to set up in your Firebase project.
This step prompts you to set configurations for specific files for the selected products or features. For more details on these configurations, refer to the specific product's documentation (for example, Hosting or Authentication). Note that you can always run
firebase initlater to set up more Firebase products.
At the end of initialization, Firebase automatically creates the following two files at the root of your local app directory:
A
firebase.jsonconfiguration file that lists your project configuration.A
.firebasercfile that stores your project aliases.
The firebase.json file
The firebase init command creates a
firebase.json configuration file in the root of your project directory.
The firebase.json file is required to
deploy assets with the Firebase CLI because it specifies
which files and settings from your project directory are deployed to your
Firebase project (like Hosting settings, Authentication provider
configurations, security rules, and Cloud Functions configuration).
Since some settings can be defined in either your project
directory or the
Firebase console, make sure that you resolve any potential
deployment conflicts.
You can configure most Firebase Hosting options
directly in the firebase.json file. However, for other
Firebase services that can be deployed with the Firebase CLI,
the firebase init command creates specific files where you can define settings
for those services, such as an index.js file for Cloud Functions. You can
also set up predeploy or postdeploy hooks in the firebase.json file.
The following firebase.json file is a comprehensive example showing
configuration options for many Firebase services. It also demonstrates features
like multi-codebase Cloud Functions, Local Emulator Suite setup, and
a Remote Config template. Note that a firebase.json file for any given
project will only contain configurations for the Firebase services set up for
that specific project (for example, only Firebase Hosting and
Cloud Functions). Adding the $schema key enables validation and
autocompletion in many code editors.
{
"$schema": "https://raw.githubusercontent.com/firebase/firebase-tools/master/schema/firebase-config.json",
"hosting": {
"public": "public",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
"cleanUrls": true,
"trailingSlash": false
},
"apphosting": {
"backendId": "my-app",
"rootDir": "backend",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
]
},
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"storage": {
"rules": "storage.rules"
},
"database": {
"rules": "database.rules.json"
},
"dataconnect": {
"source": "dataconnect",
"location": "us-central1"
},
"functions": [
{
"source": "functions",
"codebase": "default",
"ignore": [
"**/.*",
"**/node_modules/**"
],
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint",
"npm --prefix \"$RESOURCE_DIR\" run build"
]
}
],
"emulators": {
"auth": {
"port": 9099
},
"functions": {
"port": 5001
},
"firestore": {
"port": 8080
},
"hosting": {
"port": 5000
},
"storage": {
"port": 9199
},
"ui": {
"enabled": true,
"port": 4000
},
"singleProjectMode": true
},
"extensions": {
"my-storage-resizer": "firebase/storage-resize-images@^0.1.0"
},
"auth": {
"providers": {
"anonymous": true,
"emailPassword": true,
"googleSignIn": {
"oAuthBrandDisplayName": "My App",
"supportEmail": "support@myapp.com"
}
}
},
"remoteconfig": {
"template": "remoteconfig.template.json"
}
}
While firebase.json is used by default, you can pass the
--config PATH flag to specify an alternate
configuration file.
Configuration for multiple Cloud Firestore databases
When you run firebase init, your firebase.json file will contain a single
firestore key corresponding to your project's default database, as shown
in the preceding example.
If your project contains multiple Cloud Firestore databases, edit your
firebase.json file to associate different Cloud Firestore Security Rules and
database index source files with each database. Modify the file with a
JSON array, with one entry for each database.
"firestore": [
{
"database": "(default)",
"rules": "firestore.default.rules",
"indexes": "firestore.default.indexes.json"
},
{
"database": "ecommerce",
"rules": "firestore.ecommerce.rules",
"indexes": "firestore.ecommerce.indexes.json"
}
],
Cloud Functions files to ignore on deploy
At function deployment time, the CLI automatically specifies
a list of files in the functions directory to ignore. This
prevents deploying to the backend extraneous files that could
increase the data size of your deployment.
The list of files ignored by default, shown in JSON format, is:
"ignore": [
".git",
".runtimeconfig.json",
"firebase-debug.log",
"firebase-debug.*.log",
"node_modules"
]
If you add your own custom values for ignore in firebase.json, make
sure that you keep (or add, if it is missing) the list of files shown in the
preceding list.
Manage project aliases
You can associate multiple Firebase projects with the same project directory.
For example, you might want to use one Firebase project for staging and another
for production. By using different project environments, you can verify changes
before deploying to production. The firebase use command lets you switch
between aliases as well as create new aliases.
Add a project alias
When you select a Firebase project during project
initialization, the project is automatically
assigned the alias of default. However, to allow project-specific commands to
run against a different Firebase project but still use the same project
directory, run the following command from within your project directory:
firebase use --add
This command prompts you to select another Firebase project and assign the
project as alias. Alias assignments are written to a .firebaserc file inside
your project directory.
Use project aliases
To use assigned Firebase project aliases, run any of the following commands from within your project directory.
| Command | Description |
|---|---|
firebase use |
View a list of defined aliases for your project directory |
firebase use \ |
Directs all commands to run against the specified Firebase project.
The CLI uses this project as the "active project". |
firebase use --clear |
Clears the active project.
Run |
firebase use \ |
Removes an alias from your project directory. |
You can override what's being used as the active project by passing
the --project flag with any CLI command. As an example: You can set your
CLI to run against a Firebase project that you've assigned the staging
alias. If you want to run a single command against the Firebase project that
you've assigned the prod alias, then you can run, for example,
.
Source control and project aliases
In general, you should check your .firebaserc file into source control to
allow your team to share project aliases. However, for open source projects or
starter templates, you should generally not check in your .firebaserc file.
If you have a development project that's for your use only, you can either pass
the --project flag with each command or run
firebase use PROJECT_ID without assigning an alias to
the Firebase project.
Serve and test your Firebase project locally
You can view and test your Firebase project on locally hosted URLs before
deploying to production. If you only want to test select features, you can use
a comma-separated list in a flag on the firebase serve command.
Run the following command from the root of your local project directory if you want to do either of the following tasks:
- View the static content for your Firebase-hosted app.
- Use Cloud Functions to generate dynamic content for Firebase Hosting and you want to use your production (deployed) HTTP functions to emulate Hosting on a local URL.
firebase serve --only hosting
Emulate your project using local HTTP functions
Run any of the following commands from your project directory to emulate your project using local HTTP functions.
To emulate HTTP functions and hosting for testing on local URLs, use either of the following commands:
firebase serve
firebase serve --only functions,hosting // uses a flag
To emulate HTTP functions only, use the following command:
firebase serve --only functions
Test from other local devices
By default, firebase serve only responds to requests from localhost. This
means that you'll be able to access your hosted content from your computer's web
browser but not from other devices on your network. If you'd like to test from
other local devices, use the --host flag, like so:
firebase serve --host 0.0.0.0 // accepts requests to any host
Deploy to a Firebase project
The Firebase CLI manages deployment of code and assets to your Firebase project, including:
- New releases of your Firebase Hosting sites
- New, updated, or existing Cloud Functions for Firebase
- New or updated schemas and connectors for Firebase SQL Connect
- Security Rules for Firebase Realtime Database
- Security Rules for Cloud Storage for Firebase
- Security Rules for Cloud Firestore
- Indexes for Cloud Firestore
- Configuration for Authentication
To deploy to a Firebase project, run the following command from your project directory:
firebase deploy
You can optionally add a comment to each of your deployments. This comment will display with the other deployment information on your project's Firebase Hosting page. For example:
firebase deploy -m "Deploying the best new feature ever."
When you use the firebase deploy command, be aware of the following:
To deploy resources from a project directory, the project directory must have a
firebase.jsonfile. This file is automatically created for you by thefirebase initcommand.By default,
firebase deploycreates a release for all deployable resources in your project directory. To deploy specific Firebase services or features, use partial deployment.
Deploy specific Firebase services
If you only want to deploy specific Firebase services or features, you can use a
comma-separated list in a flag on the firebase deploy command. For example,
the following command deploys Firebase Hosting content and
Cloud Storage Security Rules.
firebase deploy --only hosting,storage
The following table lists the services and features available for partial
deployment. The names in the flags correspond to the keys in your
firebase.json configuration file.
| Flag syntax | Service or feature deployed |
|---|---|
--only auth |
Authentication provider configuration |
--only database |
Firebase Realtime Database Security Rules |
--only dataconnect |
Firebase SQL Connect schemas and connectors |
--only firestore |
Cloud Firestore Security Rules and indexes for all configured databases |
--only functions |
Cloud Functions for Firebase |
--only hosting |
Firebase Hosting content |
--only storage |
Cloud Storage for Firebase Security Rules |
Deployment conflicts for Security Rules
For Firebase Realtime Database, Cloud Storage for Firebase, and Cloud Firestore, you can define Security Rules either in your local project directory or in the Firebase console.
Another option to avoid deployment conflicts is to use partial deployment and only define Security Rules in the Firebase console.
Set up predeploy and postdeploy scripted tasks
You can connect shell scripts to the firebase deploy command to perform
predeploy or postdeploy tasks. For example, a predeploy script could
transpile TypeScript code into JavaScript, and a postdeploy hook could notify
administrators of new site content deploys to Firebase Hosting.
To set up predeploy or postdeploy hooks, add bash scripts to your
firebase.json configuration file. You can define
brief scripts directly in the firebase.json file, or you can reference other
files that are in your project directory.
For example, the following script is the firebase.json expression for a
postdeploy task that sends a Slack message upon successful deployment to
Firebase Hosting.
"hosting": {
// ...
"postdeploy": "./messageSlack.sh 'Just deployed to Firebase Hosting'",
"public": "public"
}
The messageSlack.sh script file resides in the project directory and looks
like this:
curl -X POST -H 'Content-type: application/json' --data '{"text":"$1"}'
\https://SLACK_WEBHOOK_URLYou can set up predeploy and postdeploy hooks for any of the
assets that you can deploy. Note that running firebase deploy
triggers all the predeploy and postdeploy tasks defined in your
firebase.json file. To run only those tasks associated with a specific
Firebase service, use partial deployment commands.
Both predeploy and postdeploy hooks print the standard output and error
streams of the scripts to the terminal. For failure cases, note the following:
- If a predeploy hook fails to complete as expected, deployment is canceled.
- If deployment fails for any reason, postdeploy hooks are not triggered.
Environment variables
Within scripts running in the predeploy and postdeploy hooks, the following environment variables are available:
$GCLOUD_PROJECT: The active project's project ID$PROJECT_DIR: The root directory containing thefirebase.jsonfile$RESOURCE_DIR: (Forhostingandfunctionsscripts only) The location of the directory that contains the Hosting or Cloud Functions resources to be deployed
Deployment quotas
It's possible (though unlikely) that you might exceed a quota that limits the
rate or volume of your Firebase deployment operations. For example, when
deploying very large numbers of functions, you might receive an HTTP 429 Quota
error message. To solve such issues, try
using partial deployment.
Roll back a deployment
You can roll back a Firebase Hosting deployment from your project's Firebase Hosting page by selecting the Rollback action for the chosen release.
It's not possible to roll back releases of Security Rules for Firebase Realtime Database, Cloud Storage for Firebase, or Cloud Firestore.
Command reference
This section describes the available commands for the following use cases and products:
- CLI administrative commands
- Project management commands
- Deployment and local development
- App Distribution commands
- App Hosting commands
- Authentication (user management) commands
- Cloud Firestore commands
- Cloud Functions for Firebase commands
- Crashlytics commands
- Extensions commands
- Extensions publisher commands
- Hosting commands
- Realtime Database commands
- Remote Config commands
- SQL Connect commands
CLI administrative commands
| Command | Description |
|---|---|
help
|
Display help information about the CLI or specific commands. |
init
|
Associate and set up a new Firebase project in the current directory.
This command creates a firebase.json
configuration file in the current directory.
|
login
|
Authenticate the CLI with your Google Account. Requires access to a web browser.
To log into the CLI in remote environments that don't allow access
to |
login:ci
|
Deprecated.
Instead, use Application Default Credentials with a Google Cloud service
account (GOOGLE_APPLICATION_CREDENTIALS).
Generate an authentication token for use in non-interactive environments. |
login:add
|
Log in an additional Google Account. |
login:list
|
List all authenticated Google Accounts. |
login:use \
|
Set the active Google Account. |
logout
|
Sign out your Google Account from the CLI. |
open
|
Open a browser to relevant project resources. |
projects:list
|
List all the Firebase projects to which you have access. |
use
|
Set the active Firebase project for the CLI. Learn more about managing project aliases. |
Project management commands
| Command | Description |
|---|---|
| Management of Firebase projects | |
projects:addfirebase
|
Add Firebase-specific configurations and enable Firebase-specific services in an existing Google Cloud project. |
projects:create
|
Create a new Google Cloud project, then add Firebase-specific configurations and enable Firebase-specific services to the new project. |
projects:list
|
List all the Firebase projects to which you have access. |
| Management of Firebase Apps (iOS, Android, Web) | |
apps:create
|
Create a new Firebase App. |
apps:list
|
List all the registered Firebase Apps in the active Firebase project. |
apps:sdkconfig \
|
Print the Firebase configuration of the specified Firebase App.
If the CLI is running in non-interactive mode:
This command supports the following optional flag:
|
| Management of SHA certificate hashes (Android only) | |
apps:android:sha:create \
|
Add the specified SHA certificate hash to the specified Firebase Android App. |
apps:android:sha:delete \
|
Delete the specified SHA certificate (identified by its SHA_ID
from apps:android:sha:list) from the specified Firebase
Android App.
|
apps:android:sha:list \
|
List all the SHA certificate hashes for the specified Firebase Android App. |
Deployment and local development
These commands let you deploy and interact with your Firebase project.
| Command | Description |
|---|---|
deploy
|
Deploy code and assets from your project directory to the active Firebase project.
This command requires a
Learn more about deploying to a Firebase project. |
serve
|
Start a local server to test your Firebase Hosting configuration
and/or local HTTP Cloud Functions (for example, using
This command requires a
Learn more about serving and testing locally. |
App Distribution commands
| Command | Description |
|---|---|
appdistribution:distribute \
|
Upload the specified release binary file (.apk,
.aab, or .ipa) and make it available to testers
for the specified Firebase App.
|
appdistribution:testers:add \
|
Add one or more testers (specified as space-separated
EMAILS) to the active Firebase project. If EMAILS
is omitted, you must pass This command only adds testers who aren't already in the project; it doesn't remove or overwrite existing testers. This command supports the following optional flags:
|
appdistribution:testers:remove \
|
Remove testers (specified as space-separated EMAILS) from the
active Firebase project. If EMAILS is omitted, you must pass
This command supports the following optional flags:
|
appdistribution:testers:list
|
List testers in the active Firebase project. |
appdistribution:groups:create \
|
Create a tester group with the specified DISPLAY_NAME and
optional GROUP_ALIAS.
If GROUP_ALIAS is omitted, an alias is automatically generated from DISPLAY_NAME. |
appdistribution:groups:delete \
|
Delete the tester group with the specified alias. |
appdistribution:groups:list
|
List all tester groups in the active Firebase project. |
App Hosting commands
| Command | Description |
|---|---|
apphosting:backends:create \
|
Create the collection of managed resources linked to a single codebase that comprises an App Hosting backend. This command supports the following optional (but recommended) flags:
This command also supports the following optional flags:
If the CLI is running in non-interactive mode, then both
|
apphosting:backends:get \
|
Retrieve the details, including the public URL, of the specified App Hosting backend.
If multiple regions contain a backend with the specified
BACKEND_ID, the CLI logs a warning and prints the first
matching backend (note that this command doesn't support the
|
apphosting:backends:list
|
List all active App Hosting backends in the active Firebase project. |
apphosting:backends:delete \
|
Delete the specified App Hosting backend.
The CLI displays a confirmation prompt before taking action. To skip
the confirmation prompt (required in non-interactive mode), pass the
following flags:
If multiple regions contain a backend with the specified
BACKEND_ID, the CLI prompts you in interactive mode to
select which backend(s) to delete, and fails if |
apphosting:rollouts:create \
|
Create a manually triggered rollout for the specified App Hosting backend. This command supports the following optional, mutually exclusive flags. If neither is provided, the CLI prompts you to select from a list of branches; in non-interactive mode, providing one of these flags is required.
If multiple regions contain a backend with the specified
BACKEND_ID, this command fails in both interactive and
non-interactive modes (note that this command doesn't support the
|
apphosting:secrets:set \
|
Create or update a secret in Google Cloud Secret Manager with the specified SECRET_NAME. This command supports the following optional (but recommended) flag:
This command also supports the following optional flag:
If the CLI is running in non-interactive mode, pass
|
apphosting:secrets:grantaccess \
|
Grant permissions to the specified secret(s) to a set of user or group emails or to a backend's service account. The secrets can then be accessed by App Hosting at build or run time.
You can pass one or more SECRET_NAME values, separated by a
comma. You must specify either Grant access to a set of user or group emails:
Grant access to a backend's service account:
|
apphosting:secrets:revokeaccess \
|
Revoke permissions to the specified secret(s) from a set of user or group emails or from a backend's service account.
You can pass one or more SECRET_NAME values, separated by a
comma. You must specify either Revoke access from a set of user or group emails:
Revoke access from a backend's service account:
|
apphosting:secrets:describe \
|
Retrieve the metadata and versions for the specified secret name. |
apphosting:secrets:access \
|
Access the value of the secret for the specified secret name at the
specified version.
If [@VERSION] is omitted, defaults to accessing
the latest version.
|
Authentication (user management) commands
| Command | Description |
|---|---|
auth:export \
|
Export the user accounts of the active Firebase project to a JSON or CSV file. For more details, see the "auth:import and auth:export" page. |
auth:import \
|
Import the user accounts from a JSON or CSV file into the active Firebase project. For more details, see the "auth:import and auth:export" page. |
Cloud Firestore commands
| Command | Description |
|---|---|
firestore:locations
|
List available locations for Cloud Firestore database instances in the active Firebase project. Learn about available locations for Standard edition, Enterprise edition, and MongoDB compatibility. |
firestore:databases:create \
|
Create the specified Cloud Firestore database instance (in native mode)
in the specified location.
This command supports the following optional flags:
|
firestore:databases:list |
List all Cloud Firestore database instances in the active Firebase project. |
firestore:databases:get \
|
Retrieve the database configuration for the specified
Cloud Firestore database instance.
The table output includes the database's |
firestore:databases:update \
|
Update the database configuration of the specified Cloud Firestore database instance. At least one flag is required (omitted flags retain their current settings). This command supports the following flags:
|
firestore:databases:delete \
|
Delete the specified Cloud Firestore database instance.
The CLI displays a confirmation prompt before taking action. To skip
the confirmation prompt (required in non-interactive mode), pass the
|
firestore:indexes
|
List all the indexes for a Cloud Firestore database instance. This command supports the following optional flag:
|
firestore:delete \
|
Delete documents at the specified database path (PATH) from a Cloud Firestore database instance.
PATH is required unless Note that deleting Cloud Firestore data using the CLI incurs read and delete costs. For more information, see Understand Cloud Firestore billing. This command supports the following optional flags:
The CLI displays a confirmation prompt before taking action. To skip
the confirmation prompt (required in non-interactive mode), pass the
following flags: |
Cloud Functions for Firebase commands
For more information, see the environment configuration documentation.
| Command | Description |
|---|---|
functions:config:export
|
Export the active Firebase project's legacy This command supports the following optional flags:
|
functions:delete \
|
Delete one or more specified functions from the active Firebase project.
The CLI displays a confirmation prompt before taking action. To skip
the confirmation prompt (required in non-interactive mode), pass the
following flags: |
functions:list
|
List all deployed functions in the active Firebase project. |
functions:log
|
Read logs from all deployed Cloud Functions in the active Firebase project. |
functions:secrets:access \
|
Access the value of the secret for the specified secret name at the
specified version.
If [@VERSION] is omitted, defaults to accessing
the latest version.
|
functions:secrets:destroy \
|
Destroy the specified secret at the specified version.
The CLI displays a confirmation prompt before taking action, which
automatically confirms in non-interactive mode without |
functions:secrets:get \
|
Retrieve the metadata and versions for the specified secret name. |
functions:secrets:prune
|
Destroy all unused secrets in the active Firebase project. |
functions:secrets:set \
|
Create or update the specified secret. |
functions:shell
|
Start a local interactive shell for testing functions. |
functions:config:clone \
|
Deprecated.
Disabled by default. To use this command, first run
|
functions:config:get
|
Deprecated.
Retrieve the existing configuration values of the active Firebase project's Cloud Functions. |
functions:config:set \
|
Deprecated.
Disabled by default. To use this command, first run
|
functions:config:unset \
|
Deprecated.
Disabled by default. To use this command, first run
|
Crashlytics commands
| Command | Description |
|---|---|
crashlytics:mappingfile:generateid \
|
Generate a unique mapping file ID in the specified Android resource (XML) file. |
crashlytics:mappingfile:upload \
|
Upload a Proguard-compatible mapping (TXT) file for the specified Firebase App, and associate it with the mapping file ID declared in the specified Android resource (XML) file. |
crashlytics:symbols:upload \
|
Generate a Crashlytics-compatible symbol file for Android native library crashes (for example, Android NDK, or Android builds of Unity or Flutter) and upload it to Firebase servers.
This command supports Android only. For iOS dSYMs, use the Apple SDK's
|
Extensions commands
| Command | Description |
|---|---|
ext
|
Display information on how to use Firebase Extensions commands.
List the extension instances installed in the active project. |
ext:configure \
|
Reconfigure the parameter values of an extension instance in your extension manifest. |
ext:info \
|
Print detailed information about an extension. |
ext:install \
|
Add a new instance of an extension into your extension manifest. |
ext:sdk:install \
|
Install SDKs for defining extensions in functions. |
ext:list
|
List all the extension instances installed in a Firebase project.
Print the instance ID for each extension. |
ext:uninstall \
|
Remove an extension instance from your extension manifest. |
ext:update \
|
Update an extension instance to the latest version (or to the specified published UPDATE_SOURCE version) in your extension manifest. Note that for UPDATE_SOURCE, local paths and URLs aren't supported.
The CLI displays a confirmation prompt before taking action. You can
pass |
ext:export
|
Export all installed extension instances from your project to your extension manifest. |
Extensions publisher commands
| Command | Description |
|---|---|
ext:dev:init
|
Initialize a skeleton codebase for a new extension in the current directory. |
ext:dev:list \
|
Print a list of all extensions uploaded by a publisher. |
ext:dev:register
|
Disabled.
Registering new publisher profile IDs is no longer supported. |
ext:dev:deprecate \
|
Deprecate
extension versions that match the version predicate.
A version predicate can be a single version (such as 1.0.0),
or a range of versions (such as >1.0.0).
If no version predicate is provided, deprecates all versions of that extension. |
ext:dev:undeprecate \
|
Undeprecate
extension versions that match the version predicate.
A version predicate can be a single version (such as 1.0.0),
or a range of versions (such as >1.0.0).
|
ext:dev:upload \
|
Upload a new version of an extension. |
ext:dev:usage \
|
Display install counts and usage metrics for extensions uploaded by a publisher. |
Hosting commands
| Command | Description |
|---|---|
hosting:disable
|
Stop serving Firebase Hosting traffic for a Hosting site. The site's Hosting URL will display a "Site Not Found" message after running this command. This command supports the following optional flag:
The CLI displays a confirmation prompt before taking action. To skip
the confirmation prompt (required in non-interactive mode), pass the
following flags: |
| Management of Hosting sites | |
hosting:sites:create \
|
Create a new Hosting site using the specified SITE_ID. If the CLI is running in non-interactive mode, then SITE_ID is required. This command supports the following optional flag:
|
hosting:sites:delete \
|
Delete the specified Hosting site.
The CLI displays a confirmation prompt before taking action. To skip
the confirmation prompt (required in non-interactive mode), pass the
following flags: |
hosting:sites:get \
|
Retrieve the details about the specified Hosting site.
The table output includes the site ID, default URL, and
Firebase Web App ID (if linked). Additional metadata (such as whether
the site is the |
hosting:sites:list
|
List all Hosting sites in the active Firebase project. |
| Management of preview channels | |
hosting:channel:create \
|
Create a new preview channel for a Hosting site using the specified
CHANNEL_ID.
If the CLI is running in non-interactive mode, then CHANNEL_ID is required. This command supports the following optional flag:
|
hosting:channel:delete \
|
Delete the specified preview channel. You cannot delete a site's live channel. This command supports the following optional flag:
The CLI displays a confirmation prompt before taking action. To skip
the confirmation prompt (required in non-interactive mode), pass the
following flags: |
hosting:channel:deploy \
|
Deploy your Hosting content and config to the specified
preview channel.
This command supports the following optional flag:
|
hosting:channel:list
|
List all channels (including the "live" channel) for a Hosting site. This command supports the following optional flag:
|
hosting:channel:open \
|
Open a browser to the URL of the specified channel or return the URL if opening in a browser isn't possible. If the CLI is running in non-interactive mode, then CHANNEL_ID is required. This command supports the following optional flag:
|
| Version cloning | |
hosting:clone \
|
Clone the most recently deployed version on the specified "source" channel to the specified "target" channel. This command also deploys to the specified "target" channel. If the "target" channel doesn't yet exist, this command creates a new preview channel in the "target" Hosting site before deploying to the channel. |
hosting:clone \
|
Clone the specified version to the specified "target" channel. This command also deploys to the specified "target" channel. If the "target" channel doesn't yet exist, this command creates a new preview channel in the "target" Hosting site before deploying to the channel. You can find the VERSION_ID in the Hosting dashboard of the Firebase console. |
Realtime Database commands
Note that you can create your initial, default Realtime Database instance in the
Firebase console or by using the
general firebase init workflow or the
specific firebase init database flow.
Once instances are created, you can manage them as described in Manage and interact with specific instances using the CLI.
| Command | Description |
|---|---|
database:get \
|
Retrieve data at the specified database location (PATH) for a Realtime Database instance and display the data as JSON. Supports querying on indexed data. This command supports the following optional flag:
|
database:instances:create \
|
Create a Realtime Database instance with the specified DATABASE_NAME in the specified location. This command supports the following optional (but recommended) flag:
You can't use this command to create the default
Realtime Database instance for the active Firebase project. If the project
doesn't contain any existing Realtime Database instances, then you're
prompted to run the |
database:instances:list
|
List all Realtime Database instances in the active Firebase project. This command supports the following optional flag:
|
database:profile
|
Build a profile of operations for a Realtime Database instance.
This command supports the following optional flag:
|
database:push \
|
Push new data to a list at the specified database location (PATH) in a Realtime Database instance.
Takes input from a file (INFILE), STDIN, or the
This command supports the following optional flag:
|
database:remove \
|
Delete all data at the specified database location (PATH) in a Realtime Database instance. This command supports the following optional flag:
The CLI displays a confirmation prompt before taking action. To skip
the confirmation prompt (required in non-interactive mode), pass the
following flags: |
database:set \
|
Replace all data at the specified database location (PATH) in a Realtime Database instance.
Takes input from a file (INFILE), STDIN, or the
This command supports the following optional flag:
The CLI displays a confirmation prompt before taking action. To skip
the confirmation prompt (required in non-interactive mode), pass the
following flags: |
database:update \
|
Perform a partial update at the specified database location (PATH) in a Realtime Database instance.
Takes input from a file (INFILE), STDIN, or the
This command supports the following optional flag:
The CLI displays a confirmation prompt before taking action. To skip
the confirmation prompt (required in non-interactive mode), pass the
following flags: |
Remote Config commands
These commands and their use cases are covered in more detail in Modify Remote Config programmatically.
| Command | Description |
|---|---|
remoteconfig:versions:list
|
List all the versions of the Remote Config template. This command supports the following optional flag:
|
remoteconfig:get \
|
Retrieve the details of the Remote Config template at the specified version. This command supports the following optional (but recommended) flags:
|
remoteconfig:rollback \
|
Roll back the Remote Config template to the specified previous version. This command supports the following optional (but recommended) flag:
The CLI displays a confirmation prompt before taking action. To skip
the confirmation prompt (required in non-interactive mode), pass the
following flags: |
remoteconfig:experiments:list
|
List all Remote Config experiments in the active Firebase project. This command supports the following optional flags:
|
remoteconfig:experiments:get \
|
Retrieve the details of the specified Remote Config experiment.
The table output includes the experiment's resource name, display
name, state ( |
remoteconfig:experiments:delete \
|
Delete the specified Remote Config experiment.
The CLI displays a confirmation prompt before taking action and
doesn't support a |
remoteconfig:rollouts:list
|
List all Remote Config rollouts in the active Firebase project. This command supports the following optional flags:
|
remoteconfig:rollouts:get \
|
Retrieve the details of the specified Remote Config rollout. |
remoteconfig:rollouts:delete \
|
Delete the specified Remote Config rollout.
The CLI displays a confirmation prompt before taking action and
doesn't support a |
SQL Connect commands
These commands and their use cases are covered in more detail in the SQL Connect CLI reference guide.
| Command | Description |
|---|---|
dataconnect:services:list
|
List all deployed SQL Connect services in the active Firebase project. |
dataconnect:sql:diff
|
Display the differences between a local SQL Connect schema and your Cloud SQL database schema. This command supports the following optional flags:
|
dataconnect:sql:migrate
|
Migrate the schema for your Cloud SQL database to match your local SQL Connect schema. This command supports the following optional flags:
In interactive mode, the CLI displays a confirmation prompt before
taking action. In non-interactive mode, non-destructive migrations run
automatically, while destructive changes abort unless you pass
|
dataconnect:sql:grant \
|
Grant the specified SQL_ROLE (one of: This command supports the following optional flags:
|
dataconnect:sdk:generate
|
Generate typed SDKs for your SQL Connect connectors. This command supports the following optional flags:
|