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
subdomains at no cost on
Before you begin
Before you can set up Firebase Hosting, you need to create a Firebase project.
Step 1: Install the Firebase CLI
Step 2: Initialize your project
To connect your local project files to your Firebase project, run the following command from the root of your local project directory:
firebase init hosting
During project initialization, from the Firebase CLI prompts:
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:
firebase deploy --only hosting
This command deploys your Hosting content and config to the following Firebase-provisioned subdomains:
Learn more about deploys and even locally testing your site.
Now your site is ready to share with the world!
Continue to improve your site. Test locally, share changes at a temporary preview URL, then deploy to your live site. Follow this step-by-step guide.
Learn about further hosting capabilities:
Take a look at the full documentation for the Firebase CLI.
Prepare to launch your app:
- Set up budget alerts for your project in the Google Cloud console.
- Monitor the Usage and billing dashboard in the Firebase console to get an overall picture of your project's usage across multiple Firebase services. You can also visit the Hosting Usage dashboard for more detailed usage information.
- Review the Firebase launch checklist.