Hono
A Hono app runs as a Cloudflare Worker: your code is bundled into one module and handles every request to the environment.
Detection
A project is Hono when hono is in its dependencies. A project that depends on both hono and @rasenganjs/futon fails detection; deploy each app as its own project.
Your entry file
The entry must default-export the app. This is what Hono's Cloudflare Workers template already does:
A Node.js server doesn't run on Workers: an entry calling serve() from @hono/node-server fails the build with a message saying so. Keep that call in a separate file for local development, or use wrangler dev.
How the entry is found
Hiraiship runs your build command, then bundles the first entry that exists, in this order:
index.jsinside the output directory (dist/index.jsby default), if your build compiles one;- the
mainof yourwrangler.toml,wrangler.jsonorwrangler.jsonc; src/index.ts,src/index.js,index.ts,index.js.
The entry and everything it imports, hono included, are bundled into one ES module with esbuild. TypeScript needs no build step of its own.
Defaults
| Setting | Default |
|---|---|
| Install command | From your lockfile, see Frameworks |
| Build command | npm run build --if-present: your build script, or nothing |
| Output directory | dist, where the entry is looked for first |
Environment variables
Environment variables are on c.env. Type them with the app's Bindings:
What's available
- Node.js built-ins (
node:crypto,node:buffer…) through Cloudflare's compatibility layer. - Outgoing
fetchcalls, up to your plan's subrequests per request. - No file system, and no Cloudflare bindings other than your variables: KV, D1 or R2 bindings declared in a
wranglerfile aren't created.