How to Host Your Website on Firebase (free)

hosting your website on Firebase is very easy, with just a few commands on the terminal and your website is up running. let get started on How to Host Your Website on Firebase.

the first thing to do is to log on to firebase, login, and create a project, enter the name of the project and you are good to go.

Next, we need to install the Firebase tool, this can be done with the following command in your terminal. But make sure you already have nodejs and npm installed on your system.
For window users, if you are having some weird error during installation, you can or download the window sub-system for Linux and run the installation, you should be good with no errors. The subsystem for Linux gives you the LINUX Command Line Interface.

npm install -g firebase-tools

Next, we need to log in to the Firebase on the terminal. The below command will open your browser and request you to enter your Firebase credentials. after a successful login, close the window and come back to the terminal.

firebase login

Next, initialize firebase using the following command

firebase init

Select the features you want to use. select hosting. you will also be asked to select your project and public directory.
Your public directory is the folder (relative to your project directory) that
will contain Hosting assets to be uploaded with Firebase deploy. If you
have a build process for your assets, use your build’s output directory.
Next, run the below command to test run your project.

firebase serve

Enter localhost:5000 on your browser to make sure your website is running. If no error, use CONTROL C to stop the server run the below command to deploy your website to firebase.

firebase deploy

Congratulations, you have successfully hosted your website. Your website will be available as a subdomain of the web.app If you need a domain, go to hosting in the firebase console and connect a domain.  each time there is an update, just run the command [firebase deploy] to update your website. 

For more information check firebase.
Thank you for reading

swagasoft

Fully stack(MEAN) software engineer with over five years of experience participating in the complete product development lifecycle of successfully launched applications. Eager and willing to deliver mission- critical technology solutions.

View all posts by swagasoft →

Leave a Reply

Your email address will not be published. Required fields are marked *