Our production-grade hosting is backed by a global content delivery network
(CDN). Hosting serves your content over SSL, by default, and can be used
with your own custom domain or on your project's
free subdomains on
Before you begin
Before you can set up Firebase Hosting, you need to create a Firebase project.
Step 1: Install the Firebase CLI
Install Node.js using one of the following options. Installing Node.js automatically installs npm.
Install the Firebase CLI using npm by running:
npm install -g firebase-tools
This command installs the globally available
firebasecommand. To update to the latest version of the Firebase CLI, re-run the same
Sign into Firebase using your Google account by running:
This command connects your local machine to Firebase and grants you access to your Firebase projects.
To test that authentication worked (and to list all of your Firebase projects), run the following command:
The displayed list should be the same as the Firebase projects listed in the Firebase console.
Update to the latest CLI version
Make sure that you're using the most up-to-date Firebase CLI version by re-running the CLI installation command:
npm install -g firebase-tools
Step 2: Initialize your project
To connect your local project to your Firebase project, run the following command from the root of your local project directory:
During project initialization, from the Firebase CLI prompts:
Select to set up
If you want to set up other Firebase products for your project, refer to their documentation for setup information. Note that you can always run
firebase initlater to set up more Firebase products.
Select a Firebase project to connect to your local project directory.
The selected Firebase project is your "default" Firebase project for your local project directory. To connect additional Firebase projects to your local project directory, set up project aliases.
Specify a directory to use as your public root directory.
This directory contains all your publicly served static files, including your
index.htmlfile and any other assets that you want to deploy to Firebase Hosting.
The default for the public root directory is called
You can specify your public root directory now or you can specify it later in your
If you select the default and don't already have a directory called
public, Firebase creates it for you.
If you don't already have a valid
404.htmlfile in your public root directory, Firebase creates them for you.
Choose a configuration for your site.
If you select to make a one-page app, then Firebase automatically adds rewrite configurations for you.
At the end of initialization, Firebase automatically creates and adds two files to the root of your local app directory:
firebase.jsonconfiguration file that lists your project configuration. Learn more about this file on the configure hosting behavior page.
.firebasercfile that stores your project aliases.
Step 3: Deploy to your site
To deploy to your site, run the following command from the root of your local project directory:
This command deploys a release to your Firebase project's default Hosting sites:
Learn more about deploys and even locally testing your site.
Now your site is ready to share with the world! You can also learn how to:
Also, take a look at the full documentation for the Firebase CLI.