Project one safely ship an AI-generated static site
Review an AI-generated frontend, validate home and 404 routes with Workers Static Assets, and prepare a reversible release.
Edited and verified by Orange Book Editorial Team ·
Done means
Home returns 200, an unknown route returns a real 404, source contains no unexpected tracking or secrets, and a Wrangler dry run builds. This tutorial does not deploy remotely for you.
Prerequisites and architecture
- Node 22 and pnpm; no Worker handler is required.
- Work from repository root with
examples/ai-static-site/. - Save AI output as ordinary HTML/CSS/JS that a human can inspect.
Browser → Cloudflare Workers Static Assets → public/index.html or public/404.htmlWorkers Static Assets is the current path. Do not let generated code fall back to deprecated Workers Sites, site.bucket, or @cloudflare/kv-asset-handler.
Files
Build and verify
Review generated output
Search for unknown remote scripts, inline tokens, automatic form submission, hidden iframes, and unsafe HTML injection. Remove unwanted analytics and give images alt text, dimensions, and local sources.
Start locally
pnpm wrangler dev --config examples/ai-static-site/wrangler.jsoncVerify two routes
curl -I http://127.0.0.1:8787/
curl -I http://127.0.0.1:8787/does-not-existExpect 200 and 404. Then navigate by keyboard and inspect narrow-screen and dark-mode output.
Dry-run only
pnpm wrangler deploy --dry-run --config examples/ai-static-site/wrangler.jsoncA real deploy creates external state. Confirm account, name, domain, and rollback target first.
Rollback and next step
Retain the prior known-good version and change custom-domain routing separately. If the new site fails, roll back the Worker version before touching DNS and source together.
Next: Workers + D1 API.
Primary sources
Did this page help you complete your goal?
Beta feedback is generated in this browser and is never uploaded automatically.