Google Firebase can host your website or application with HTML, JavaScript and CSS files.

To host your project with Firebase Hosting, create a new folder and paste your all files that you need to host but make sure you have one index.html file in your project root directory.

  1. To get started with Firebase Hosting, log in to the Firebase console and go to Hosting panel of your project’s Dashboard.
  2. Now we will install firebase CLI (command line tool). The Firebase CLI requires Node.js and npm so for that you have to install Node.js and npm before installing Firebase CLI.
  3. After installing Node.js and npm, open Node.js command prompt and run the following command:-
      npm install -g firebase-tools 

 

 

  1. This command provides Firebase globally available. Next step is to initialize your site.
  2. Then go to project directory by cd command and go to project’s root directory then run the following command  Firebase init
  3. When you run this command  this gives an error of firebase authentication so you need to run command  firebase login

 

 

  1. Above command will prompt you something  to accept certain permissions so please type Y and hit enter , so you will be redirected  as below

 

 

  1. Now again run firebase init command and choose the firebase CLI feature. For Firebase Hosting we need to choose Hosting: Configure and deploy Firebase Hosting sitesthis option

 

 

  1. Then you select your default firebase project. For this you can use your existing project or may be create new project. Here I am creating new project on firebase console with Firebase Hosting .To create new project go to firebase console i.e. https://console.firebase.google.com/
  2. After creating new project then again run firebase init command and choose hosting option and then select your project.
  3. After that to deploy your project on firebase, simply run the following command from project’s root directory i.e. Firebase deploy
  4. Before running this command you have to change your firebase JSON from your project root directory to like this:-
{

"hosting": {

"public": ".",

"ignore": [

"firebase.json",

"**/.*",

"**/node_modules/**"

]

}

}

 

  1.  This command deploy your project <YOUR-FIREBASE-APP>.firebaseapp.com
  2.  After deploying your project, run command firebase open and choose Hosting: Deployed sites. This command opens your site in default browser.

 

 

So finally your project is hosted on Firebase.

My site is hosted with this https://fir-hosting-4bad4.firebaseapp.com/  URL .You can watch your site hosting URL on Firebase console Hosting panel Dashboard.

When you make any changes in your any file, then again run firebase deploy command which will update your file on Firebase.

 

Simple steps to host website on Firebase

Most Popular

Have a Great startup Idea and want to make it possible? Looking for an extraordinary team to build a mobile or Web app for your idea to come into reality? Then you are at right place. I provide my services for mobile and web app development.

Copyright © 2019 CrocoCode. All rights reserved.

To Top