This guide walks you through migrating an existing static site or single-page application (SPA) from Firebase Hosting to Cloudflare Workers with Workers Static Assets.
If your Firebase Hosting project uses a supported web framework, review the Workers framework guides or run wrangler deploy to automatically detect your framework and generate a Workers configuration. Otherwise, continue with the steps below.
Check your firebase.json file for the hosting.public field, which specifies the build output directory Firebase deploys:
{
"hosting": {
"public": "dist",
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
}
}Identify your project's build command in package.json (typically npm run build or a framework-specific command such as ng build). If firebase.json includes a catch-all rewrite to /index.html, your app is configured as a Single Page Application (SPA).
In the root of your project, create a wrangler.jsonc file. Replace <your-project-name> with your Worker name and <your-build-directory> with the public directory from firebase.json.
For a static site (Static Site Generation):
{
"name": "<your-project-name>",
// Set this to today's date
"compatibility_date": "2026-11-28",
"assets": {
"directory": "<your-build-directory>"
}
}name = "<your-project-name>"
# Set this to today's date
compatibility_date = "2026-11-28"
[assets]
directory = "<your-build-directory>"For a Single Page Application (matching a Firebase ** → /index.html rewrite):
{
"name": "<your-project-name>",
// Set this to today's date
"compatibility_date": "2026-11-28",
"assets": {
"directory": "<your-build-directory>",
"not_found_handling": "single-page-application"
}
}name = "<your-project-name>"
# Set this to today's date
compatibility_date = "2026-11-28"
[assets]
directory = "<your-build-directory>"
not_found_handling = "single-page-application"If your firebase.json defines custom HTTP headers or URL redirects, move them into _headers and _redirects files inside your static asset output directory.
- Push your updated repository (including
wrangler.jsonc) to GitHub or GitLab. - Follow Connect a new Worker to link your repository to Workers Builds.
- Set your Build command (for example,
npm run build) and keep the default Deploy command (npx wrangler deploy).
Alternatively, deploy directly from your terminal with npx wrangler deploy.
Workers Custom Domains support domains whose DNS is managed by Cloudflare.
- Verify your deployed Worker on its
*.workers.devsubdomain. - In your domain's DNS > Records page, remove any Firebase Hosting
A,AAAA, orCNAMErecords for the hostname you are migrating. - Follow Add a Custom Domain to attach the domain to your Worker.
- Once traffic is serving from Workers, remove the old site from Firebase Hosting.