A correct firebase.json without the guesswork
Firebase Hosting is configured by a single firebase.json file, and small mistakes — a wrong public directory, a missing SPA rewrite, or no cache headers — lead to 404s on deep links or stale assets after deploys. This builder assembles a valid config from a few toggles so your first firebase deploy works.
How it works
The tool writes a hosting object. The public key points at your build folder, and ignore excludes firebase.json and dotfiles (plus node_modules if you want). When the single-page-app option is on, it adds a catch-all rewrite that maps ** to /index.html, so client-side routes resolve instead of 404ing. The cache-header block applies Cache-Control: public, max-age=<seconds>, immutable to hashed static assets (js, css, fonts, images) while forcing no-cache on index.html, which is the standard pattern for content-hashed builds. cleanUrls and trailingSlash map directly to Firebase’s own options.
Example and notes
A typical Vite or Create React App setup uses dist (Vite) or build (CRA) as the public directory with the SPA rewrite enabled. Keep the asset max-age at 31536000 (one year) only when your bundler adds content hashes to filenames; without hashing, a long cache can serve stale code. The generated JSON is standard and can be extended later with redirects, headers for security, or multiple hosting targets.