CLI toolkit

toolkit overview

The firebase CLI allows to:

  • run and debug an emulated backend locally, with no incurred cost: an authentication server, a database, and serverless functions.

  • start a shell session from the CLI to call and debug the emulated cloud functions.

  • scaffold a project or a directory with boilerplate code, notably the cloud functions directory.

  • deploy cloud functions, security rules, and possibly a website.

  • list and manage the firebase projects that live on the current account

install the executable through npm

the npm package's name is different from the executable

firebase-tools 	# npm package
firebase 				# executable name

CLI setup

firebase login
firebase login:list # indicates which account is logged in

project initialization

firebase init

main uses

firebase help
firebase help deploy # get help about a command

firebase help | grep firestore # filter lines
firebase help | grep functions

firebase projects:list

firebase functions:list
firebase functions:shell

firebase functions:secrets:set OPENAI_API_KEY
firebase functions:secrets:get OPENAI_API_KEY


firebase deploy
firebase deploy --only functions
firebase deploy --only functions:requestPlanet

emulators

start emulators:

firebase emulators:start
firebase emulators:start --import=./emulatorData/ --export-on-exit

We specify which emulator to run in firebase.json. In absence of such file, no emulator may run. The port is optional: we may omit it and provide an empty object instead.

{
    "emulators": {
        "firestore": { "port": 8080 },
        "auth": { "port": 9099 },
        "functions": { "port": 5001 },
        "storage": { "port": 9199 },
        "ui": { "enabled": true }
    },
    "storage": { "rules": "storage.rules" },
    "functions": [
        {
            "source": "functions",
            "codebase": "default",
            "ignore": [
                "node_modules",
                ".git",
                "firebase-debug.log",
                "firebase-debug.*.log",
                "*.local"
            ],
            "predeploy": ["npm --prefix \"$RESOURCE_DIR\" run build"]
        }
    ]
}
earlymorning logo

© 2025 - All rights reserved

CLI toolkit

toolkit overview

The firebase CLI allows to:

  • run and debug an emulated backend locally, with no incurred cost: an authentication server, a database, and serverless functions.

  • start a shell session from the CLI to call and debug the emulated cloud functions.

  • scaffold a project or a directory with boilerplate code, notably the cloud functions directory.

  • deploy cloud functions, security rules, and possibly a website.

  • list and manage the firebase projects that live on the current account

install the executable through npm

the npm package's name is different from the executable

firebase-tools 	# npm package
firebase 				# executable name

CLI setup

firebase login
firebase login:list # indicates which account is logged in

project initialization

firebase init

main uses

firebase help
firebase help deploy # get help about a command

firebase help | grep firestore # filter lines
firebase help | grep functions

firebase projects:list

firebase functions:list
firebase functions:shell

firebase functions:secrets:set OPENAI_API_KEY
firebase functions:secrets:get OPENAI_API_KEY


firebase deploy
firebase deploy --only functions
firebase deploy --only functions:requestPlanet

emulators

start emulators:

firebase emulators:start
firebase emulators:start --import=./emulatorData/ --export-on-exit

We specify which emulator to run in firebase.json. In absence of such file, no emulator may run. The port is optional: we may omit it and provide an empty object instead.

{
    "emulators": {
        "firestore": { "port": 8080 },
        "auth": { "port": 9099 },
        "functions": { "port": 5001 },
        "storage": { "port": 9199 },
        "ui": { "enabled": true }
    },
    "storage": { "rules": "storage.rules" },
    "functions": [
        {
            "source": "functions",
            "codebase": "default",
            "ignore": [
                "node_modules",
                ".git",
                "firebase-debug.log",
                "firebase-debug.*.log",
                "*.local"
            ],
            "predeploy": ["npm --prefix \"$RESOURCE_DIR\" run build"]
        }
    ]
}