Initialize & Configure the Emulator

Learn how to initialize and configure the emulator to test locally.

Initialize the emulators

In your terminal, start with creating a new branch:

git switch -c add-firebase-emulators

Navigate to services/web/firebase. You first need to login to Firebase:

npm run firebase:login

Now, initialize the emulators with this command:

./node_modules/.bin/firebase init emulators

The wizard already recognized that we use Firestore and Hosting. Press “Enter” to accept the default selection. When prompted for the Firestore and Hosting ports, also accept the default 8080 and 5000, respectively.

Note: Port 5000 for Hosting is important because we use that port in the services/web/src/server.js file to set up the redirect for Firebase’s implicit URLs. Port 8080 for Firestore is also important because we will later set environment variables to point to that port.

When asked whether to enable the Emulator UI, press “Y” to accept and “Enter” for the next question to accept any available port.

Lastly, press “Y” to download the emulators now.

Get hands-on with 1200+ tech skills courses.