As always, the entire Firebase Reference Project is open source, and the hosted code is available as a repository. There is also a pull request for the very minor changes made to the Android reference app.
- First install npm & node.js, used to handle the Firebase installation process.
- Next, open a Command Prompt and enter
npm install -g firebase-tools, after a few minutes you should see something similar to the following image:
- Next, login to your Firebase account using
firebase login. This will open a browser with a login request. Once logged in, the Command Prompt will report success.
- Next, navigate to the directory you want to deploy code from.
firebase initto initialise a local Firebase project. You will be prompted to choose a service (choose “Hosting”), and a Firebase project to use.
- Finally, pick a folder to use for your public files (default is “public”), and whether you want a single page web app (this can be changed later).
Deploying your site is very easy, just enter
firebase deploy and within a few seconds the updated files are published. That’s it! The same process is used for the initial deployment as well as all subsequent deployments.
By default, your project will have a URL like
https://fir-referenceproject.firebaseapp.com/. However, custom domains / subdomains can be added within a minute or two by following the simple steps displayed when “Connect domain” is pressed.
First, enter your custom URL. I’ll be using
Next, you need to prove you own the URL. This is done by adding a
TXT record in your domain’s DNS, accessible under the “DNS” tab in Cloudflare.
Finally, you now need to add the actual
A records that will allow Firebase to serve content for your URL. This is done by adding 2 entries, each with your target subdomain as the “Name”, and the specified IPs as the “IPv4 Address”.
Firebase Hosting’s very limited function set is easily seen when accessing the web interface. Each tab provides the bare essentials, and sometimes not even that!
The dashboard displays a list of all connected custom domains, and a list of all releases. Previous releases can be easily rolled back to or deleted, but no information is available about them. As such, an external source code manager like Git will still be essential for development.
The usage tab shows 2 simple graphs; your storage space used over time, and your data transfer size over time. The free “Spark” plan has a limit of 1GB of storage space, and 10GB/month of data transfer.
Before judging Firebase Hosting too harshly, it’s important to remember that this isn’t meant to replace traditional web hosts. Instead, it is intended as an extremely quick & simple way to have a web app live on the internet, with CDN + HTTPS + custom domain, for free. Whilst it absolutely can be used for production-level apps, the lack of any controls may make even the most cutting-edge web developer a little bit hesitant.
Considering the amazingly easy to use deployment process, and the industry standard features offered for free, Firebase Hosting is definitely a contender for quick site prototypes. It can also hook into Firebase Cloud Functions to handle server / database communication or data transfer with other systems.
I personally will most likely use it next time a simple idea needs testing, and eagerly await being up and running within a minute or two!