<Project id="gatsby-adapter-firebase" />

Gatsby Adapter for Firebase

Gatsby adapter that translates redirects, headers, SSR, and functions into Firebase Hosting and Functions.

Project Overview

gatsby-adapter-firebase lets Gatsby sites deploy to Firebase Hosting without hand-editing config files. It keeps redirects, headers, caching, SSR, DSG, and Gatsby Functions lined up with Firebase Hosting and Cloud Functions.

Why

Gatsby’s adapter hook gives a single place to wire platform features together, but Firebase needed a mapping layer. The adapter unifies Gatsby’s build output with Firebase’s config so the deployment flow stays short and repeatable.

What It Handles

  • Updates the targeted hosting block in firebase.json, merging redirects, rewrites, and headers while leaving other projects alone.
  • Builds Gatsby Functions—SSR, DSG, and file-based handlers—into a Firebase Functions codebase with per-function overrides.
  • Ships a cached SSR path for deferred pages by storing responses in Firebase Storage and tagging hits and misses with headers.
  • Applies Gatsby’s default caching guidance so static assets and Lambda-style responses get the right cache-control headers.
  • Generates a live demo site at gatsbyfire.web.app to test the adapter end to end.

Development Notes

  • TypeScript + Node 20, bundled through pkgroll, and exported as both ESM and CJS.
  • Tests cover the generated config and function wrappers with Vitest and Supertest against memfs.
  • CI runs on GitHub Actions with coverage sent to Codecov and automated releases via Semantic Release.

Check out the project repository on Github for more info.