Deployment and Hosting

Next, we have to deploy our PWA to a server in order to make it available to the public and be sure that it works in a remote environment.


Nowadays, there are plenty of hosting possibilities to choose from, and all are almost equivalent in terms of performance and services offered.

Therefore, we are free to choose the provider we prefer, but in this lesson, we will use the Firebase platform to host our application. Since we used Cloud Firestore for its offline persistence capabilities in a previous demo, using Firebase hosting is a natural choice.
This is not a rule, however. We can still use Cloud Firestore as NoSQL DB but host our application in Azure or Netlify, for instance. The decision is ours.


Firebase hosting

Firebase hosting is a web content hosting offered by the Firebase platform. It has many interesting advantages and, thanks to its CLI, setting up and deploying projects are extremely quick and easy.

Firebase hosting provides great features, not only for static web content, but also for more complex and dynamic apps:

  • Secure: SSL is provided for the hosted data out of the box. We do not have to purchase a certificate. Our web app will be delivered through HTTPs protocol, according to Google’s goal to have an overall secure web.

  • Fast: The deployed files are cached on SSDs at CDN edges in different locations. This means that the closest CDN location will deliver the data to our clients, ensuring that our content is delivered fast.

  • Easy to deploy: Thanks to the Firebase CLI, we can simply setup our local project with basic Firebase parameters and deploy it to the cloud with one command. Moreover, through the Firebase console, we can get a set of important details about the downloads or the in-/outbound traffic from our application.
    If we find an error in the latest release, we can also rollout a previous version with a mouse click.



Setup Firebase

Below we describe all the needed packages and commands to ...