Migrate to Netlify Today

Netlify announces the next evolution of Gatsby Cloud. Learn more

Deploying to Firebase Hosting

Firebase Hosting is a free web content hosting platform for developers. With a single command, you can quickly deploy web apps and serve both static and dynamic content to a global CDN (content delivery network).



  1. Install the Firebase CLI with npm by running the following command:

  2. Sign in to Firebase using your Google account by running the following command:

    You can test if the CLI is correctly installed by running firebase projects:list, which should show you a list of your Firebase Projects.

  3. Navigate into your gatsby project directory and setup firebase:

    This command will prompt you to:

    • select the Firebase products you wish to set up. Be sure to select Firebase Hosting.
    • select the Firebase project you wish to use or create a new one, if you haven’t done it previously.

    When prompted to select your public directory, press enter. It will default to public, which is also Gatsby’s default public directory.

  4. Update the firebase.json with the following cache settings

  5. Prepare your site for deployment by running gatsby build. This generates a publishable version of your site in the public folder.

  6. Deploy your site by running the following command:

All done! Once the deployment concludes, you can access your website using firebaseProjectId.firebaseapp.com or firebaseProjectId.web.app.

Check the Firebase Docs for information about how to customize your deployment further. Remember that each time you wish to redeploy your site, you will need to rerun gatsby build first.

For automatic setup of builds that are deployed straight to Firebase:

Start building today on Netlify!


Firebase doesn’t support advanced features like SSR, DSG, or Image CDN. You can get all features and faster builds by signing up to Gatsby Cloud.

Additional resources

Start building today on Netlify!
Edit this page on GitHub
© 2023 Gatsby, Inc.