Get Started with Firebase Hosting

Firebase Hosting gives you a fast, secure, and reliable way to host your app's static assets (HTML, CSS, JavaScript, media files, etc.) as well as to serve dynamic content and host microservices. 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 a subdomain of firebaseapp.com.

To use Firebase Hosting, make sure that you've created a Firebase project and completed the "Get Started" wizard on your Firebase project's Hosting page.

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.

Access your Firebase projects

To connect your local machine to your Firebase account and obtain access to your Firebase projects, run the following command:

firebase login

Initialize your site

From the root of your project directory, run the following command:

firebase init

Running the firebase init command creates a firebase.json configuration file in the root of your project directory. You can learn more about this file in the configure hosting behavior section of this guide.

Select a public root directory

When you initialize your site, you are prompted for a directory to use as the public root (default is "public"). If you don't already have a valid index.html file in your public root directory, one is created for you.

Deploy your site

To deploy your site, run the following command from your project's root directory:

firebase deploy

Your content will be deployed to your Firebase project's default Hosting site, your-firebase-project-id.firebaseapp.com.

Next steps

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.

Şunun hakkında geri bildirim gönderin...

Yardım mı gerekiyor? Destek sayfamızı ziyaret edin.