13.7.4 • Published 3 days ago

firebase-tools v13.7.4

Weekly downloads
316,231
License
MIT
Repository
github
Last release
3 days ago

Firebase CLI Actions Status Node Version NPM version

The Firebase Command Line Interface (CLI) Tools can be used to test, manage, and deploy your Firebase project from the command line.

  • Deploy code and assets to your Firebase projects
  • Run a local web server for your Firebase Hosting site
  • Interact with data in your Firebase database
  • Import/Export users into/from Firebase Auth

To get started with the Firebase CLI, read the full list of commands below or check out the documentation.

Installation

Node Package

You can install the Firebase CLI using npm (the Node Package Manager). Note that you will need to install Node.js and npm. Installing Node.js should install npm as well.

To download and install the Firebase CLI run the following command:

npm install -g firebase-tools

This will provide you with the globally accessible firebase command.

Standalone Binary

The standalone binary distribution of the Firebase CLI allows you to download a firebase executable without any dependencies.

To download and install the CLI run the following command:

curl -sL firebase.tools | bash

Commands

The command firebase --help lists the available commands and firebase <command> --help shows more details for an individual command.

If a command is project-specific, you must either be inside a project directory with an active project alias or specify the Firebase project id with the -P <project_id> flag.

Below is a brief list of the available commands and their function:

Configuration Commands

CommandDescription
loginAuthenticate to your Firebase account. Requires access to a web browser.
logoutSign out of the Firebase CLI.
login:ciGenerate an authentication token for use in non-interactive environments.
login:addAuthorize the CLI for an additional account.
login:listList authorized CLI accounts.
login:useSet the default account to use for this project
useSet active Firebase project, manage project aliases.
openQuickly open a browser to relevant project resources.
initSetup a new Firebase project in the current directory. This command will create a firebase.json configuration file in your current directory.
helpDisplay help information about the CLI or specific commands.

Append --no-localhost to login (i.e., firebase login --no-localhost) to copy and paste code instead of starting a local server for authentication. A use case might be if you SSH into an instance somewhere and you need to authenticate to Firebase on that machine.

Project Management Commands

CommandDescription
apps:createCreate a new Firebase app in a project.
apps:listList the registered apps of a Firebase project.
apps:sdkconfigPrint the configuration of a Firebase app.
projects:addfirebaseAdd Firebase resources to a Google Cloud Platform project.
projects:createCreate a new Firebase project.
projects:listPrint a list of all of your Firebase projects.

Deployment and Local Emulation

These commands let you deploy and interact with your Firebase services.

CommandDescription
emulators:execStart the local Firebase emulators, run a test script, then shut down the emulators.
emulators:startStart the local Firebase emulators.
deployDeploys your Firebase project. Relies on firebase.json configuration and your local project folder.
serveStart a local server with your Firebase Hosting configuration and HTTPS-triggered Cloud Functions. Relies on firebase.json.
setup:emulators:databaseDownloads the database emulator.
setup:emulators:firestoreDownloads the firestore emulator.

App Distribution Commands

CommandDescription
appdistribution:distributeUpload a distribution.

Auth Commands

CommandDescription
auth:importBatch importing accounts into Firebase from data file.
auth:exportBatch exporting accounts from Firebase into data file.

Detailed doc is here.

Realtime Database Commands

CommandDescription
database:getFetch data from the current project's database and display it as JSON. Supports querying on indexed data.
database:setReplace all data at a specified location in the current project's database. Takes input from file, STDIN, or command-line argument.
database:pushPush new data to a list at a specified location in the current project's database. Takes input from file, STDIN, or command-line argument.
database:removeDelete all data at a specified location in the current project's database.
database:updatePerform a partial update at a specified location in the current project's database. Takes input from file, STDIN, or command-line argument.
database:profileProfile database usage and generate a report.
database:instances:createCreate a realtime database instance.
database:instances:listList realtime database instances.
database:settings:getRead the realtime database setting at path
database:settings:setSet the realtime database setting at path.

Extensions Commands

CommandDescription
extDisplay information on how to use ext commands and extensions installed to your project.
ext:configureConfigure an existing extension instance.
ext:infoDisplay information about an extension by name (extensionName@x.y.z for a specific version)
ext:installInstall an extension.
ext:listList all the extensions that are installed in your Firebase project.
ext:uninstallUninstall an extension that is installed in your Firebase project by Instance ID.
ext:updateUpdate an existing extension instance to the latest version.

Cloud Firestore Commands

CommandDescription
firestore:deleteDelete documents or collections from the current project's database. Supports recursive deletion of subcollections.
firestore:indexesList all deployed indexes from the current project.

Cloud Functions Commands

CommandDescription
functions:logRead logs from deployed Cloud Functions.
functions:listList all deployed functions in your Firebase project.
functions:config:setStore runtime configuration values for the current project's Cloud Functions.
functions:config:getRetrieve existing configuration values for the current project's Cloud Functions.
functions:config:unsetRemove values from the current project's runtime configuration.
functions:config:cloneCopy runtime configuration from one project environment to another.
functions:secrets:setCreate or update a secret for use in Cloud Functions for Firebase.
functions:secrets:getGet metadata for secret and its versions.
functions:secrets:accessAccess secret value given secret and its version. Defaults to accessing the latest version.
functions:secrets:pruneDestroys unused secrets.
functions:secrets:destroyDestroy a secret. Defaults to destroying the latest version.
functions:deleteDelete one or more Cloud Functions by name or group name.
functions:shellLocally emulate functions and start Node.js shell where these local functions can be invoked with test data.

Hosting Commands

CommandDescription
hosting:disableStop serving Firebase Hosting traffic for the active project. A "Site Not Found" message will be displayed at your project's Hosting URL after running this command.

Remote Config Commands

CommandDescription
remoteconfig:getGet a Firebase project's Remote Config template.
remoteconfig:versions:listGet a list of the most recent Firebase Remote Config template versions that have been published.
remoteconfig:rollbackRoll back a project's published Remote Config template to the version provided by --version_number flag.

Use firebase:deploy --only remoteconfig to update and publish a project's Firebase Remote Config template.

Authentication

General

The Firebase CLI can use one of four authentication methods listed in descending priority:

  • User Token - DEPRECATED: this authentication method will be removed in a future major version of firebase-tools; use a service account to authenticate instead - provide an explicit long-lived Firebase user token generated from firebase login:ci. Note that these tokens are extremely sensitive long-lived credentials and are not the right option for most cases. Consider using service account authorization instead. The token can be set in one of two ways:
    • Set the --token flag on any command, for example firebase --token="<token>" projects:list.
    • Set the FIREBASE_TOKEN environment variable.
  • Local Login - run firebase login to log in to the CLI directly as yourself. The CLI will cache an authorized user credential on your machine.
  • Service Account - set the GOOGLE_APPLICATION_CREDENTIALS environment variable to point to the path of a JSON service account key file. For more details, see Google Cloud's Getting started with authentication guide.
  • Application Default Credentials - if you use the gcloud CLI and log in with gcloud auth application-default login, the Firebase CLI will use them if none of the above credentials are present.

Multiple Accounts

By default firebase login sets a single global account for use on all projects. If you have multiple Google accounts which you use for Firebase projects you can authorize multiple accounts and use them on a per-project or per-command basis.

To authorize an additonal account for use with the CLI, run firebase login:add. You can view the list of authorized accounts with firebase login:list.

To set the default account for a specific Firebase project directory, run firebase login:use from within the directory and select the desired account. To check the default account for a directory, run firebase login:list and the default account for the current context will be listed first.

To set the account for a specific command invocation, use the --account flag with any command. For example firebase --account=user@domain.com deploy. The specified account must have already been added to the Firebase CLI using firebase login:add.

Cloud Functions Emulator

The Cloud Functions emulator is exposed through commands like emulators:start, serve and functions:shell. Emulated Cloud Functions run as independent node processes on your development machine which means they have their own credential discovery mechanism.

By default these node processes are not able to discover credentials from firebase login. In order to provide a better development experience, when you are logged in to the CLI through firebase login we take the user credentials and construct a temporary credential that we pass into the emulator through GOOGLE_APPLICATION_CREDENTIALS. We only do this if you have not already set the GOOGLE_APPLICATION_CREDENTIALS environment variable yourself.

Using behind a proxy

The CLI supports HTTP(S) proxies via environment variables. To use a proxy, set the HTTPS_PROXY or HTTP_PROXY value in your environment to the URL of your proxy (e.g. HTTP_PROXY=http://127.0.0.1:12345).

Using with CI Systems

The Firebase CLI requires a browser to complete authentication, but is fully compatible with CI and other headless environments.

Complete the following steps to run Firebase commands in a CI environment. Find detailed instructions for each step in Google Cloud's Getting started with authentication guide.

  1. Create a service account and grant it the appropriate level of access to your project.
  2. Create a service account key (JSON file) for that service account.
  3. Store the key file in a secure, accessible way in your CI system.
  4. Set GOOGLE_APPLICATION_CREDENTIALS=/path/to/key.json in your CI system when running Firebase commands.

To disable access for the service account, find the service account for your project in the Google Cloud Console, and then either remove the key, or disable or delete the service account.

Using as a Module

The Firebase CLI can also be used programmatically as a standard Node module. Each command is exposed as a function that takes positional arguments followed by an options object and returns a Promise.

So if we run this command at our command line:

$ firebase --project="foo" apps:list ANDROID

That translates to the following in Node:

const client = require("firebase-tools");
client.apps
  .list("ANDROID", { project: "foo" })
  .then((data) => {
    // ...
  })
  .catch((err) => {
    // ...
  });

The options object must be the very last argument and any unspecified positional argument will get the default value of "". The following two invocations are equivalent:

const client = require("firebase-tools");

// #1 - No arguments or options, defaults will be inferred
client.apps.list();

// #2 - Explicitly provide "" for all arguments and {} for options
client.apps.list("", {});

Note: when used in a limited environment like Cloud Functions, not all firebase-tools commands will work programatically because they require access to a local filesystem.

vue_fabric_canvasshieldmessagingfirebase-authentication-clientcampy@everything-registry/sub-chunk-1671@fstore/cliweb-app-startxataxcloudfirebasenodefirelogueshazam-cli@johnnybossboy/cra-templatethe_forgetaxi-app-installtaxi-patch-packagetaxi-patch-package-2teaching-naseersynergeticstest-yaratesting_registry_file_structurett-firestore-utilitiestyped-component-galleryvite-plugin-firebasetsg-garagevue-infinite-scroll-table@juananestival/fire@getcircuit/firestore-test@invisible-cms/firebase@nothingmore/generator@mozilla/rally-functions@nx-extend/firebase-hosting@mallanic/vite-plugin-firebasefirebase-deploy-directoryfirebase-functions-webpackfirebase-security-testingfirebase-migratefirebase-replacefirebase-requestfiretable@netoaxi/nexicube-cliexicube-cliexicubeappsioauth-master@dwmkerr/tripweather@econlab/ember-cli-deploy-firebasehyperdeployinstant-toolsember-cli-firebase-hostingember-cli-deploy-firebaseember-cli-deploy-firebase-appember-firebase-sdk@jaspero/cli@sentrei/functions@sentrei/mobile@sentrei/types@factor/service-firebase-app-build@shraddhabhuju/packagetest@singpath/rules@stormweyr/firebase-inspectkirjs-test-ng-deploy@tradera/tradera-uibloombox@bloombox/js-client@blast-engine/cloud-control@cajacko/project-templatesautora-firebase-functions@backupfire/firebase@any-cloud/firebaseappsynth-platformappflint@firelayer/cli@findus./patternson-clicars-chat-devcaber-cli@boundstate/firebase-migrate@xanderia/xataaana-climenrva-appknowledge-graph-byjus@vuesion/addon-firebaseangular-cli-firebase-hostingcra-template-autora-firebaseplatwatch-api@dev-engage/universal-coredobi-fbreact-markdown-markosreact-chunky-clireact-graphql-github-apolloconsumer-web-authconfig-tinkercreate-react-app-perfcreate-react-plus-app@discue/idempotent-firebase-functionscj-project-templatesdonejs-deploydiscordbanslookupserverless-firebase-functionsserverless-firebase-rulesrxfire-admin
13.7.4

3 days ago

13.7.3

9 days ago

13.7.2

15 days ago

13.7.1

21 days ago

13.7.0

22 days ago

13.6.1

24 days ago

13.6.0

1 month ago

13.5.2

1 month ago

13.5.1

1 month ago

13.5.0

1 month ago

13.4.1

2 months ago

13.4.0

2 months ago

13.3.1

2 months ago

13.3.0

2 months ago

13.2.0

3 months ago

13.2.1

3 months ago

13.1.0

3 months ago

13.0.3

4 months ago

13.0.2

4 months ago

13.0.1

5 months ago

13.0.0

5 months ago

12.8.0

6 months ago

12.8.1

6 months ago

13.0.0-canary.0

5 months ago

12.9.0

5 months ago

12.9.1

5 months ago

12.6.1

7 months ago

12.6.2

7 months ago

12.6.0

7 months ago

12.5.3

8 months ago

12.5.4

8 months ago

12.7.0

7 months ago

12.4.8

8 months ago

12.5.2

8 months ago

12.5.0

8 months ago

12.5.1

8 months ago

12.4.3

10 months ago

12.4.4

10 months ago

12.4.5

9 months ago

12.4.6

9 months ago

12.4.1

10 months ago

12.4.2

10 months ago

12.4.7

9 months ago

12.4.0

11 months ago

12.3.0

11 months ago

12.3.1

11 months ago

12.0.1

12 months ago

12.2.1

11 months ago

12.2.0

11 months ago

12.1.0

11 months ago

11.28.0

1 year ago

11.30.0

12 months ago

11.27.0

1 year ago

11.29.0

1 year ago

11.29.1

1 year ago

12.0.0

12 months ago

11.26.0

1 year ago

11.24.1

1 year ago

11.24.0

1 year ago

11.23.0

1 year ago

11.23.1

1 year ago

11.25.0

1 year ago

11.25.2

1 year ago

11.25.1

1 year ago

11.25.3

1 year ago

11.22.0

1 year ago

11.21.0

1 year ago

11.16.0

1 year ago

11.16.1

1 year ago

11.20.0

1 year ago

11.15.0

2 years ago

11.18.0

1 year ago

11.14.3-canary.0

2 years ago

11.17.0

1 year ago

11.19.0

1 year ago

11.14.0

2 years ago

11.14.2

2 years ago

11.14.1

2 years ago

11.14.4

2 years ago

11.14.3

2 years ago

11.10.1-canary.0

2 years ago

11.10.1-canary.2

2 years ago

11.10.1-canary.1

2 years ago

11.10.0

2 years ago

11.8.0

2 years ago

11.8.1

2 years ago

11.12.0

2 years ago

11.11.0

2 years ago

11.9.0

2 years ago

11.12.1-canary.0

2 years ago

11.13.0

2 years ago

11.11.1-canary.0

2 years ago

11.6.0

2 years ago

11.5.0

2 years ago

11.0.0

2 years ago

11.0.1

2 years ago

11.7.0

2 years ago

11.2.2

2 years ago

11.2.0

2 years ago

11.2.1

2 years ago

11.1.0

2 years ago

11.4.2

2 years ago

11.4.0

2 years ago

11.4.1

2 years ago

11.3.0

2 years ago

10.8.0

2 years ago

10.7.0

2 years ago

10.7.1

2 years ago

10.7.2

2 years ago

10.9.0

2 years ago

10.9.1

2 years ago

10.9.2

2 years ago

10.2.2

2 years ago

10.4.1

2 years ago

10.4.2

2 years ago

10.4.0

2 years ago

10.3.0

2 years ago

10.3.1

2 years ago

10.6.0

2 years ago

10.5.0

2 years ago

10.0.0

2 years ago

10.0.1

2 years ago

9.23.1

2 years ago

9.23.2

2 years ago

9.23.3

2 years ago

10.2.0

2 years ago

10.2.1

2 years ago

10.1.4

2 years ago

10.1.5

2 years ago

10.1.0

2 years ago

10.1.1

2 years ago

10.1.2

2 years ago

10.1.3

2 years ago

9.23.0

2 years ago

9.22.0

2 years ago

9.21.0

3 years ago

9.20.0

3 years ago

9.19.0

3 years ago

9.18.0

3 years ago

9.17.0

3 years ago

9.16.6

3 years ago

9.16.3

3 years ago

9.16.4

3 years ago

9.16.5

3 years ago

9.16.1

3 years ago

9.16.2

3 years ago

9.16.0

3 years ago

9.15.1

3 years ago

9.15.0

3 years ago

9.14.0

3 years ago

9.13.1

3 years ago

9.13.0

3 years ago

9.12.0

3 years ago

9.12.1

3 years ago

9.11.0

3 years ago

9.10.2

3 years ago

9.10.1

3 years ago

9.10.0

3 years ago

9.9.0

3 years ago

9.8.0

3 years ago

9.7.0

3 years ago

9.6.1

3 years ago

9.6.0

3 years ago

9.5.0

3 years ago

9.4.0

3 years ago

9.3.0

3 years ago

9.2.2

3 years ago

9.2.1

3 years ago

9.2.0

3 years ago

9.1.2

3 years ago

9.1.1

3 years ago

9.1.0

3 years ago

9.0.1

3 years ago

9.0.0

3 years ago

8.20.0

3 years ago

8.19.0

3 years ago

8.18.1

3 years ago

8.18.0

3 years ago

8.17.0

3 years ago

8.16.2

3 years ago

8.16.1

3 years ago

8.16.0

3 years ago

8.15.1

3 years ago

8.15.0

3 years ago

8.14.1

3 years ago

8.14.0

4 years ago

8.13.1

4 years ago

8.13.0

4 years ago

8.12.1

4 years ago

8.12.0

4 years ago

8.11.2

4 years ago

8.11.1

4 years ago

8.11.0

4 years ago

8.10.0

4 years ago

8.9.2

4 years ago

8.9.1

4 years ago

8.9.0

4 years ago

8.8.1

4 years ago

8.8.0

4 years ago

8.7.0

4 years ago

8.6.0

4 years ago

8.5.0

4 years ago

8.4.3

4 years ago

8.4.2

4 years ago

8.4.1

4 years ago

8.4.0

4 years ago

8.3.0

4 years ago

8.2.0

4 years ago

8.1.1

4 years ago

8.1.0

4 years ago

8.0.3

4 years ago

8.0.2

4 years ago

8.0.1

4 years ago

8.0.0

4 years ago

7.16.2

4 years ago

7.16.1

4 years ago

7.16.0

4 years ago

7.15.1

4 years ago

7.15.0

4 years ago

7.14.0

4 years ago

7.13.1

4 years ago

7.13.0

4 years ago

7.12.1

4 years ago

7.12.0

4 years ago

7.11.0

4 years ago

7.10.0

4 years ago

7.9.0

4 years ago

7.8.1

4 years ago

7.8.0

4 years ago

7.7.0

4 years ago

7.6.2

4 years ago

7.6.1

5 years ago

7.6.0

5 years ago

7.5.0

5 years ago

7.4.0

5 years ago

7.3.2

5 years ago

7.3.1

5 years ago

7.3.0

5 years ago

7.2.4

5 years ago

7.2.3

5 years ago

7.2.2

5 years ago

7.2.1

5 years ago

7.2.0

5 years ago

7.1.1

5 years ago

7.1.0

5 years ago

7.0.2

5 years ago

7.0.1

5 years ago

7.0.0

5 years ago

6.12.0

5 years ago

6.11.0

5 years ago

6.10.0

5 years ago

6.9.2

5 years ago

6.9.1

5 years ago

6.9.0

5 years ago

6.8.0

5 years ago

6.7.2

5 years ago

6.7.1

5 years ago

6.7.0

5 years ago

6.6.0

5 years ago

6.5.3

5 years ago

6.5.2

5 years ago

6.5.1

5 years ago

6.5.0

5 years ago

6.4.0

5 years ago

6.3.1

5 years ago

6.3.0

5 years ago

6.2.2

5 years ago

6.2.1

5 years ago

6.2.0

5 years ago

6.1.2

5 years ago

6.1.1

5 years ago

6.1.0

5 years ago

6.0.1

5 years ago

6.0.0

6 years ago

5.1.1

6 years ago

5.1.0

6 years ago

5.0.1

6 years ago

5.0.0

6 years ago

4.2.1

6 years ago

4.2.0

6 years ago

4.1.2

6 years ago

4.1.1

6 years ago

4.1.0

6 years ago

4.0.3

6 years ago

4.0.2

6 years ago

4.0.1

6 years ago

4.0.0

6 years ago

3.19.3

6 years ago

3.19.2

6 years ago

3.19.1

6 years ago

3.19.0

6 years ago

3.18.6

6 years ago

3.18.5

6 years ago

3.18.4

6 years ago

3.18.3

6 years ago

3.18.2

6 years ago

3.18.1

6 years ago

3.18.0

6 years ago

3.17.7

6 years ago

3.17.6

6 years ago

3.17.5

6 years ago

3.17.4

6 years ago

3.17.3

6 years ago

3.17.2

6 years ago

3.17.1

6 years ago

3.17.0

6 years ago

3.16.0

6 years ago

3.15.4

6 years ago

3.15.3

6 years ago

3.15.2

6 years ago

3.15.1

6 years ago

3.15.0

6 years ago

3.14.0

6 years ago

3.13.1

7 years ago

3.13.0

7 years ago

3.12.0

7 years ago

3.11.0

7 years ago

3.10.1

7 years ago

3.10.0

7 years ago

3.9.2

7 years ago

3.9.1

7 years ago

3.9.0

7 years ago

3.8.0

7 years ago

3.7.0

7 years ago

3.6.1

7 years ago

3.6.0

7 years ago

3.5.0

7 years ago

3.4.0

7 years ago

3.3.0

7 years ago

3.2.3

7 years ago

3.2.2

7 years ago

3.2.1

7 years ago

3.2.0

7 years ago

3.1.0

7 years ago

3.0.8

8 years ago

3.0.7

8 years ago

3.0.6

8 years ago

3.0.5

8 years ago

3.0.4

8 years ago

3.0.3

8 years ago

3.0.2

8 years ago

3.0.1

8 years ago

3.0.0

8 years ago

2.2.1

8 years ago

2.2.0

8 years ago

2.1.1

8 years ago

2.1.0

8 years ago

2.0.2

9 years ago

2.0.1

9 years ago

2.0.0

9 years ago

1.2.0

9 years ago

1.1.6

9 years ago

1.1.5

9 years ago

1.1.4

10 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.5.0

10 years ago

0.4.0

10 years ago

0.3.0

10 years ago

0.2.0

10 years ago

0.1.6

10 years ago

0.1.5

10 years ago

0.1.4

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago