Learn to install Node.js & Firebase CLI, initialize a Firebase project, run local emulators, connect your app, and debug seamlessly.

Book a call with an Expert
Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.
Step 1: Install Node.js and npm
First, ensure that Node.js and npm (Node Package Manager) are installed on your system. They are required to manage projects and dependencies. To check if you have them installed, run the following commands:
node -v
npm -v
If not installed, download and install them from the official Node.js website.
Step 2: Set Up Firebase CLI
Install Firebase CLI (Command Line Interface) through npm to access Firebase commands:
npm install -g firebase-tools
Verify the installation:
firebase --version
Step 3: Initialize Firebase Project
Navigate to your project directory and initialize Firebase:
firebase login
This logs you into Firebase using Google credentials.
Initialize a new Firebase project:
firebase init
Follow the prompts:
Proceed to confirm the Firebase initialization.
Step 4: Start the Emulator Suite
Once Firebase project initialization is complete, start the emulators with the following command:
firebase emulators:start
Firebase will start the services you selected in the initialization step. Any web or mobile applications you develop can interact with these locally running versions of Firebase services.
Step 5: Connect Your App to Emulators
To connect your app to the Firebase emulators, update configurations in your project to point to the emulators' endpoints instead of the actual Firebase services.
Here's an example of how to update endpoints in your JavaScript/Node.js app:
const admin = require('firebase-admin');
const serviceAccount = require('/path/to/serviceAccountKey.json');
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: 'http://localhost:9000?ns=your-database-name'
});
// Firestore emulator example
const db = admin.firestore();
db.settings({
host: "localhost:8080",
ssl: false
});
Ensure your app uses these configurations only during local development.
Step 6: Testing and Debugging
With the emulator suite running and your app connected, you can now test and debug your application as if it were using live Firebase services. Utilize the Emulator UI (if enabled in Step 3) by opening the URL displayed in the terminal to manage and inspect your local Firebase database, Firestore, and more.
Step 7: Stop Emulators
Once you have completed your testing, stop the emulators either by pressing Ctrl + C in the terminal running the emulators or by running:
firebase emulators:stop
This will safely terminate all running emulators.
Step 8: Advanced Emulator Configurations (Optional)
You can further configure the Firebase emulator suite by editing the firebase.json file in your project directory. This file allows you to customize emulator settings, such as port numbers and service behavior. For complex setups, refer to the Firebase documentation for field-specific configurations.
Example firebase.json snippet:
{
"emulators": {
"firestore": {
"port": 8080
},
"database": {
"port": 9000
},
"ui": {
"enabled": true
}
}
}
This setup will make your development environment closely resemble production, ensuring your app behaves consistently across environments.
When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.