📖 Scenario: You are starting a new web project and want to use Firebase services. To manage your Firebase project easily, you need to set up the Firebase Command Line Interface (CLI) on your computer.
🎯 Goal: Set up the Firebase CLI tool on your computer and initialize a Firebase project folder ready for deployment.
📋 What You'll Learn
Install Firebase CLI globally using npm
Log in to Firebase using the CLI
Initialize a Firebase project in the current folder
Select the default Firebase project during initialization
💡 Why This Matters
🌍 Real World
Developers use Firebase CLI to manage and deploy Firebase projects efficiently from their local machines.
💼 Career
Knowing how to set up and use Firebase CLI is essential for frontend and backend developers working with Firebase services.
Progress0 / 4 steps
1
Install Firebase CLI globally
Run the command npm install -g firebase-tools in your terminal to install the Firebase CLI globally on your computer.
Firebase
Hint
Use npm to install the Firebase CLI globally so you can use the firebase command anywhere.
2
Log in to Firebase using CLI
Run the command firebase login in your terminal to log in to your Firebase account through the CLI.
Firebase
Hint
This command opens a browser window to authenticate your Firebase account.
3
Initialize Firebase project in current folder
Run the command firebase init in your terminal to start the Firebase project initialization in the current folder.
Firebase
Hint
This command lets you select Firebase features and sets up configuration files.
4
Select default Firebase project during initialization
During firebase init, select your existing Firebase project by choosing it from the list to set it as the default project for this folder.
Firebase
Hint
When prompted, use arrow keys to select your Firebase project and confirm.
Practice
(1/5)
1. What is the main purpose of the Firebase CLI tool?
easy
A. To create Firebase projects online automatically
B. To write Firebase database rules only
C. To manage Firebase projects from your computer
D. To replace the Firebase console website
Solution
Step 1: Understand Firebase CLI role
The Firebase CLI is a command-line tool that lets you control Firebase projects locally on your computer.
Step 2: Compare options
Options B, C, and D describe limited or incorrect roles. Only To manage Firebase projects from your computer correctly states the main purpose.
Final Answer:
To manage Firebase projects from your computer -> Option C
Quick Check:
Firebase CLI = Manage projects locally [OK]
Hint: Firebase CLI controls projects from your PC, not just online [OK]
Common Mistakes:
Thinking Firebase CLI only edits database rules
Believing it creates projects automatically online
Confusing it with the Firebase web console
2. Which command correctly installs the Firebase CLI using npm?
easy
A. install firebase-cli -npm
B. npm install -g firebase-tools
C. npm firebase install -g
D. firebase install npm-tools
Solution
Step 1: Recall npm install syntax
The correct npm command to install a global package is 'npm install -g package-name'.
Step 2: Match with Firebase CLI package
The Firebase CLI package name is 'firebase-tools', so the correct command is 'npm install -g firebase-tools'.