Notes

Getting started with Firebase Hosting

Edit on GitHub

Databases
2 minutes

tl;dr

 1npm i -g firebase-tools
 2firebase login # will be redirected to Google Auth page
 3
 4cd /your-project-directory
 5
 6firebase init # initialize a project
 7# go through the initialization options
 8firebase deploy # deploy a site
 9# a public URL will be provided where you can see your websites
10firebase open # Hosting: Deployed Site
11firebase use --add # setup a staging environment (add a project alias)
12firebase use foo # use foo environment 
13firebase deploy # deploy changes to foo (whatever env you are in)

You can only create a project through the Firebase console. In order to manage projects with the CLI, you should create it at the web interface first.

A project directory must have a firebase.json to be able to deploy, which is created for you when you run firebase init. Alias definitions are written to a hidden file called .firebaserc, this file gets updated when you add an alias with firebase use --add.

Connect a custom domain name

Connect a domain

From the Hosting panel of the Firebase Console for your project, select Connect Domain.

Domain ownership verification

You’ll need to either add a TXT record at your domain host, or upload a file to your site to prove domain ownership.

Point at Firebase hosting

To point your domain to Firebase Hosting you’ll need to add/update a CNAME (for subdomains) or an A (domains without subdomains) record.

Wait for SSL certificate provisioning

After domain is provisioned, SSL provisioning starts and can take several hours.