Deploy Your Site

Firebase Hosting gives you a fast, secure and reliable way to host your app's static assets such as HTML, CSS, JavaScript, and media files. Our production-grade hosting is backed by a global CDN, serves content over SSL by default, and is available either on your own custom domain or on a subdomain of firebaseapp.com.

Getting started

To get started with Firebase Hosting, log in to the Firebase console, navigate to the Hosting panel of your project's dashboard and click Get Started.

Next, we'll install the Firebase CLI (command line tool) and initialize your site.

Install the Firebase CLI

The Firebase CLI (Command Line Interface) requires Node.js and npm, which can both be installed by following the instructions on https://nodejs.org/. Installing Node.js also installs npm.

Once you have Node.js and npm installed, you can install the Firebase CLI via npm:

npm install -g firebase-tools

This installs the globally available firebase command. To update to the latest version, simply re-run the same command.

Initializing your site

If you have an existing Firebase project you'd like to deploy, cd to the project's root directory and run:

$ firebase init

Deploying your site

To deploy your site, simply run the following command from your project directory:

$ firebase deploy

This will deploy your project to <YOUR-FIREBASE-APP>.firebaseapp.com. In the next section, we'll walk through using a custom domain with Firebase Hosting.

The firebase.json File

The firebase init command creates a firebase.json configuration file in the root of your project's directory. Your default firebase.json Hosting configuration will look like this:

{
  "hosting": {
    "public": "app",
    "ignore": [
      "firebase.json",
      "**/.*",
      "**/node_modules/**"
    ]
  }
}

The file's default properties - public, and ignore—are described in detail below.

public

"public": "app"

required - The public setting tells the firebase command which directory to upload to Firebase Hosting. This directory must be inside the project directory and must exist. The default value is a directory named "public" in your project directory.

ignore

"ignore": [
  "firebase.json",
  "**/.*",
  "**/node_modules/**"
]

optional - The ignore setting is an optional parameter that specifies files to ignore on deploy. It can take glob definitions the same way Git handles .gitignore.

Send feedback about...

Need help? Visit our support page.