Host website for Free on Firebase

Firebase Hosting gives you a fast, secure, and reliable way to host your app’s static assets (HTML, CSS, JavaScript, media files, etc.) as well as to serve dynamic content and host microservices.

And, the best part: It is FREE! (most part of it is).

As an added plus:

How to host your website on Firebase?

So, how can you host your HTML, CSS & JavaScript website on it?

Host website on Firebase for Free

First, setup up a Firebase project.

Firebase New Project

Remember: The unique Project ID or identifier that you’ll specify here would become the default URL for the free domain (web.app and firebaseapp.com).

You can change it by clicking on the little pencil icon and specifying one of choice. It has to be available. Once you’re satisfied, hit Save!

Configure Project ID

The new project should take some time to create.

Till then let's look at our website files.

Website file structure

I have my index.html, styles.css and index.js in a folder called public.

The files are linked and on localhost display a simple:

Portfolio website on LocalHost

We’ll host this on the project created.

Using the side navigation of your created Firebase project, go down to Hosting under Build.

Navigate to Hosting

Now, follow the steps as mentioned.

You’ll have to first, Install the Firebase CLI

Open the terminal and run: npm install -g firebase-tools

Next, you’ll need to sign in to your Google account.

Type in: firebase login (and, it’ll display a url that you need to click on and authenticate with).

Now, initiate your project

Run this command: firebase init

When you’ll run this command, the terminal would ask you:

And, that is it! You’ll get a message saying: Firebase initialization complete!

The last step is to type in: `firebase deploy`

This command will deploy your website to the default URL and it’ll be hosted.

The Hosting URL would also be printed out to console and you can visit it to see the deployment.

These are all the steps required to host your HTML, CSS, JavaScript website for Free on Firebase Hosting complete with SSL and a free domain.

Thank you so much for reading! 👋

I also have a video tutorial on it. Check it out here:

Video tutorial on Firebase Hosting

--

--

Developer and Designer with knack for building apps!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store