How it works
One app, four lives
The same Hono app drives development, the build, the preview, and the deployed site: four roles, learned one piece at a time.
- 01 · Dev
Bun serves the app directly
bun run devBun detects the app's
fetchand serves it.--hotre-evaluates the code on every save, and a small script polls a hash endpoint to reload the browser. Dev behaves like production: same routes, same security headers. - 02 · Build
toSSG bakes every route to a file
bun run buildscripts/build.tsclearsdist/, runstoSSGfromhono/bun, and copiespublic/over. Bun transpiles the TSX at runtime; there is no compile step and no bundler. - 03 · Preview
Wrangler reproduces the Pages shape
bun run previewwrangler pages dev distis the only tool that serves the built output with real Pages semantics: genuine 404s,_headersapplied, the 404.html fallback working. - 04 · Deploy
Pages runs the build and serves the files
git pushCloudflare Pages' Git integration runs
bun run buildon every push and servesdist/from the edge. Pages understands_headersand404.htmlnatively; nothing else is needed.