LinuxCommandLibrary

firebase

Manage Firebase projects and deployments

TLDR

Log in to

$ firebase login
copy

List existing Firebase projects
$ firebase projects:list
copy

Start an interactive wizard to create a Firebase project in the current directory
$ firebase init
copy

Deploy code and assets to the current Firebase project
$ firebase deploy
copy

Start a local server to statically host the current Firebase project's assets
$ firebase serve
copy

Start an interactive wizard to open one of many links of the current Firebase project in the default web browser
$ firebase open
copy

SYNOPSIS

firebase <command> [<global-options>] [<args>]

PARAMETERS

--debug, -d
    Output verbose debug information to stderr
[boolean]

--project <projectId>, -p
    Target specific Firebase project ID (overrides firebase.json or env var)
[string]

--token <token>
    Use custom access token instead of default auth
[string]

--only <targets>
    Deploy or affect only listed targets (e.g., hosting, functions)
[array]

--except <targets>
    Exclude listed targets from operations (e.g., !functions)
[array]

--json
    Format output as JSON for scripting
[boolean]

--help, -h
    Display help for command or subcommand
[boolean]

--force
    Skip confirmations, e.g., for deletions
[boolean]

DESCRIPTION

The firebase command provides the official command-line interface (CLI) for Google's Firebase platform, allowing developers to manage backend services for web, mobile, and server-side applications from the terminal.

It supports key workflows like project setup with firebase init, deploying static content, Cloud Functions, Firestore indexes, and Realtime Database rules via firebase deploy; local development servers with firebase serve; emulation of services using firebase emulators:start; project switching with firebase use; authentication via firebase login; and advanced features like CI/CD integration, extensions management, and Firestore data operations.

Configuration is stored in a firebase.json file, which defines deploy targets and settings. The CLI targets specific projects using the --project flag or environment variables. It's widely used in development pipelines for rapid iteration and production deploys.

Installation requires Node.js (v12+) and npm: run npm install -g firebase-tools. After install, authenticate once with firebase login. The tool integrates seamlessly with Git for version-controlled deployments.

CAVEATS

Requires Node.js v12+ and npm; install via npm install -g firebase-tools. Not in standard package managers. Needs Google auth; some commands require billing-enabled projects.

INSTALLATION

npm install -g firebase-tools
Verify: firebase --version

AUTHENTICATION

firebase login for browser-based OAuth.
firebase logout to sign out.

MAIN SUBCOMMANDS

init: Setup project.
deploy: Push to Firebase.
emulators:start: Local emulation.
use: Switch projects.

HISTORY

Released in 2015 by Google as part of Firebase tools expansion. Evolved from early gcloud-firebase; now v13+, supports modern features like emulators (2019), extensions (2020), and multi-tenancy.

SEE ALSO

npm(1), node(1), git(1)

Copied to clipboard