How to host static website on Google Firebase Hosting for Free | KartiK Tech

How to host static website on Google Firebase Hosting for Free | KartiK Tech



This is My second Video Sorry for bad voice over.
If you like the video do like share and subscribe to my channel

What is Firebase Hosting?
Firebase hosting is a Google hosting service which provides static web content to the user in a secure, fast, free and easy way.

Why Firebase Hosting?
Most of the web hosting will charge you or will be slow if they are free, also you have to pay extra for getting an SSL certificate to convert your website to a secure one with HTTPS.
Firebase hosting is free. So, it won’t cost you anymore. It by default provides SSL certificate and offers an impressive speed across multiple geographic locations without the need for a separate CDN on top.

Requirements

Google Account:
I believe you might already have a Gmail account, which is enough. If not create one.

Firebase-CLI:
Before you can install the Firebase CLI, you will need to install Node.js on your machine.
Node.js :
Once you’ve installed NodeJs, you can install the Firebase CLI using npm (the Node Package Manager) by running the following command:

npm install -g firebase-tools

Domain:
This is optional. There are various domain name providers in the world.

Lets Get Started:
Step 1: Creating firebase project

Go to firebase and sign in with your Google account
then create new project, enter your project name

Step 2: Firebase Login
First we have to login into firebase from command line. Open The Command prompt. Type in the following command:

firebase login

It will take you to the sign-in page in the browser, once you’ve successfully logged in it will show you something like this
Firebase CLI login Successful

Step 3: Initializing project
To initialize firebase project you have to enter the command:

firebase init

Then you have to select Hosting feature and click enter

Then it will ask you to select Existing firebase project or create a new Project

Select Choose Existing project

Then, select project which we created in step 1

Then it will ask you enter the main folder in which all your website assets are present.
Enter Public in the command Prompt and hit enter

It will ask you whether your application is single page or not, press n

It will try to override your index.html file, to avoid doing that enter n

Step 4: Deployment
For deployment of your project you have to run command:

firebase deploy

Congratulations! your website is now live, you can check by going to url which is provided in the command line

Bonus Step: Connecting your domain
Go to firebase console, select the project which you’ve created
select hosting tab under develop tab

Then click on connect domain

Then enter your domain url

Then add the txt record and value into your domain provider dns

Then add A records to you domain provider dns

It will take upto 5min-1hour depending on your domain provider to update dns records
That’s how easy it is to setup your website on the firebase.

Leave a Reply

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