firebase
cli
cheatsheet
commands

Based on https://firebase.google.com/docs/cli.

Firebase CLI Cheatsheet

First, you need to install Firebase CLI globally - npm install -g firebase-tools.

On Windows common issue is that after installing this package globally you'll get an error when typing any command about missing the environment variable. You can add it manually, or restart the computer/IDE works too.

If it's still not working, you may use the Git Bash terminal instead of Powershell.

In your IDE select a concrete terminal type or find it directly in your programs.

If the problem still occurs you may need to manually add an alias, following the guide specified in this: Stackoverflow thread.

Mostly Used

// Trigger auth.
firebase login
// Logouts.
firebase logout
// Creating a project with CLI.
firebase init
// List projects.
firebase projects:list
// Changing a project to "greenonsoftware-api".
firebase use greenonsoftware-api
// Changing project via CLI aliases
firebase use --add
// Clears the active project.
firebase use --clear
// Serve and test project locally.
firebase serve --only hosting
// Deploy the whole project.
firebase deploy
// Deploy the whole project with comments.
firebase deploy -m "My comment"
// Deploy specific parts.
firebase deploy --only hosting,storage,firestore,database,functions
// Generates package-lock.json only.
npm install --package-lock-only
// Cleans npm cache.
npm cache clean --force

Functions

// To deploy functions only.
firebase deploy --only functions
// To deploy concrete functions.
firebase deploy --only functions:function1functions:addMessage,functions:makeUppercase
// To delete functions in all regions.
firebase functions:delete myFunction
Author avatar
About Authorpraca_praca

👋 Hi there! My name is Adrian, and I've been programming for almost 7 years 💻. I love TDD, monorepo, AI, design patterns, architectural patterns, and all aspects related to creating modern and scalable solutions 🧠.