Firebase is a mobile and web application development platform that was developed by Firebase, Inc. in 2011. It was acquired by Google in 2014 and rolled up into the Google Cloud service. Now, it’s a flagship product of the Google Cloud offering.

Firebase is a complex and articulated product, mainly targeted at mobile applications.

One of its lesser known features that we’ll discuss in this article is the Firebase advanced web hosting service.

Firebase Hosting Features

Firebase Hosting provides hosting for static web sites, such as

sites you can generate using static site generators

sites built with server-side CMS platforms, from which you generate a static copy of the website

You can host anything as long as it’s not dynamic. A WordPress blog, for example, is almost always a good candidate to be a static site if you use Disqus or Facebook comments.

Firebase Hosting delivers files through the Fastly CDN, using HTTPS and provides an automatic SSL certificate, with custom domain support.

Its free tier is generous, with cheap plans available if you outgrow it. It’s very developer-friendly, provides a CLI interface tool, an easy deployment process, and one-click rollbacks.

Why should you use Firebase Hosting?

Firebase can be a good choice to deploy static websites, and Single Page Apps.

I like to use Firebase Hosting mainly because I tested many different providers and Firebase offers an awesome speed across multiple geographic locations without the need for a separate CDN on top, since the CDN is built-in for free.

While having your own VPS is a very good option, the overhead of managing your own server for a simple website is just not worth it. I’d prefer to focus on the content rather than on the operations, just like I’d deploy an app on Heroku.

Firebase is even easier to setup than Heroku.

Install the Firebase CLI tool

Install the Firebase CLI with

npm install -g firebase-tools

or

yarn global add firebase-tools

Authenticate with the Google account (I’m assuming you already have a Google account) by running

As you can see, we tell that for all files ending with jpg|jpeg|gif|png|css|jsFirebase should apply the Cache-Control:max-age=1000000 directive, which means that all assets are cached for more than 1 week.

Publish the site

When you are ready to publish the site, you just run the following command and Firebase will take care of everything.