Deploy a Web Page on Firebase Hosting

Before deploying a website on firebase hosting, you need to create an account and a new project in the firebase console.

Install Firebase Tools

Once you have created your account, we are going to install the firebase tools package on your computer, to do so you only have to execute the following npm command in your console.

npm install -g firebase-tools
NPM Command to Globally Install Firebase Tools

Initialize Firebase in your Project

Once Firebase is installed, we are going to initialize Firebase Hosting in our project using the following command.

firebase init
Command to Initialize Firebase

This command will ask you for some configuration fields that you must fill in the console with the services that you need.

In the following image you can see all the necessary configuration for Firebase Hosting.

Firebase Hosting Setup
Firebase Hosting Setup

As you can see, this command is going to generate 2 files.

  • .firebaserc: Contains information about the project and where it is going to be deployed.
  • firebase.json: Contains information and rules of your services.


Once you have completed the configuration we are going to deploy your project on firebase hosting using the next command.

firebase deploy --only hosting
Command to Deploy a Web Page in Firebase Hosting

If you have more than one service like firestore, functions or another, you can use the command firebase deploy to deploy all services directly.

Finally, you can go to firebase and verify that your project has been deployed using the link that will appear in the console once the deploy has been completed.