Deploy our PWA to Firebase

Practice what you learned in the previous lesson and deploy the PWA demo app in Firebase.

Objective

At the bottom of this lesson is a copy of the Angular PWA we saw in the previous chapter. We will use it to test the Firebase commands and deploy our project to the Firebase platform.


Create a Firebase project

Before proceeding further, we must create a new Firebase project using the Firebase console.


Setup the Angular project

Firebase config. object

As you previously learned, we need to add the configuration object to our project. This object contains all the keys required by Firebase to bind with our project.

The object keys look like the following (of course, your project will produce completely different values):

Press + to interact
{
apiKey: "SyAK3jHFQdpF7xS42AxJ7Gh2wSBChs2svvcJ",
authDomain: "educative-pwa.firebaseapp.com",
databaseURL: "https://educative-pwa.firebaseio.com",
projectId: "educative-pwa",
storageBucket: "educative-pwa.appspot.com",
messagingSenderId: "3364045128815",
appId: "1:3364045128815:web:h37d2810a4bdr99j14e251"
}

We are free to store the keys wherever we want in our project. For our demo, I stored them in a firebaseConfig object, inside the environment.ts and environment.prod.ts files (within the src folder).
In the widget below, I omitted the keys related to unused features, like storageBucket or databaseURL, for instance. For your convenience, you can enter the values of your keys in the relative fields ...