Skip to content

Hono and fetch handlers

Deploy Hono or a Worker-compatible fetch handler from GitHub, without Arkor configuration.

View as Markdown

Next.js is Arkor's recommended framework and the main focus of its performance work. Its Partial Prerendering, ISR and Cache Components integration can serve cached content before dynamic rendering finishes. Hono and other Worker-compatible fetch handlers also run on Cloudflare, using their native request and response behavior.

Deploy without configuration

Import the repository as in the Quickstart, and select the app's directory. A Hono app needs its usual dependency and a Worker entrypoint, for example:

src/index.ts
import { Hono } from 'hono';

const app = new Hono();
app.get('/', (c) => c.text('Hello from Cloudflare'));

export default app;

An app without a framework can export the Worker's fetch method:

src/index.ts
export default {
  fetch(request: Request) {
    return Response.json({ pathname: new URL(request.url).pathname });
  },
};

No Arkor package, adapter or Wrangler file is required. Arkor bundles the entrypoint into a Cloudflare Worker. A Worker without package dependencies may also omit package.json. It checks src/index before root index, trying .ts, .tsx, .mts, .js, .jsx and .mjs in that order, and uses the first existing file. Hono is identified from the app's declared dependency and installed version. Next.js takes priority when the selected app declares it; select each app's own directory in a mixed monorepo.

For HTTP requests, the default export can be a Hono app, an object with a fetch method, or a class extending WorkerEntrypoint from cloudflare:workers with a fetch method. A scheduled-only Worker can omit fetch and export scheduled() with triggers.crons configured; see Cron jobs. A Node.js or Bun server that opens a listening socket needs a Worker-compatible entrypoint. See the official Hono Workers guide.

Existing builds and Wrangler configuration

Arkor runs a custom project build command when configured; otherwise it runs the existing package.json build script with the repository's package manager, then a Wrangler build.command when no script exists. A project using @cloudflare/vite-plugin without one of those commands runs vite build. Otherwise Wrangler bundles the source directly.

The generated .wrangler/deploy/config.json takes priority over wrangler.json, wrangler.jsonc and wrangler.toml, in that order. Arkor reads the configuration again after the build, so a build can generate its Worker output. An explicit main must exist; Arkor does not replace a missing configured entrypoint with a guessed source file. Compatibility dates, flags, aliases and Worker module imports are bundled using Wrangler.

Static assets and streaming

Without a Wrangler configuration, an existing public/ directory is deployed as native static assets under the ASSETS binding. With a configuration, use its assets settings; no directory is inferred when those settings are absent. If configured assets omit binding, they use native asset routing without adding an ASSETS binding to your Worker. Arkor excludes hidden files and directories except .well-known. It also excludes node_modules, deployment output, and known Worker sources and project configuration from public assets. These exclusions cannot be negated in .assetsignore; its additional rules are read only from the asset directory root. Asset responses follow Cloudflare's routing, including _headers, _redirects, .assetsignore and run_worker_first. If a Worker must authenticate a request before an asset is served, configure Worker-first routing. See Cloudflare's asset routing guide.

Dynamic responses, streaming bodies, cookies and WebSocket upgrades pass through the application's Worker. Arkor does not buffer a stream to finish rendering or turn a personalized response into a shared cached page. These apps do not use the Next.js cached-shell resume or ISR paths.

The build page identifies Hono with its installed version, or shows Fetch handler for an app without a framework. Build output shows native asset counts. The detailed source route tree and runtime cache inspection remain Next.js features.

Environment and storage

Configure secrets and storage in Arkor. Project environment variables and secrets override matching Wrangler vars; JSON variables retain their JSON values unless overridden. Platform names and resource binding names cannot be replaced by application variables.

Read bindings from the fetch handler's env argument, or Hono's c.env. For example, after adding a D1 binding named DB:

src/index.ts
import { Hono } from 'hono';

const app = new Hono<{ Bindings: { DB: D1Database } }>();
app.get('/health', async (c) => {
  const row = await c.env.DB.prepare('select 1 as ok').first();
  return c.json(row);
});

export default app;

Use Cloudflare's Workers types for native binding types. KV, R2 and D1 resources are managed by Arkor, with separate resources for production and branch previews. Existing Cloudflare resource IDs, routes and account settings in Wrangler are not imported. A declared resource binding must match the name and kind assigned to that service in Arkor. The assigned binding name can differ from the underlying resource's name. Durable Object publication and the platform's Workers AI adapter are not supported for these bundles.

For scheduled work, export a scheduled() handler and declare triggers.crons in Wrangler; see Cron jobs. Other event-trigger provisioning is not supported. To connect applications privately, configure Services and releases in Arkor; existing Wrangler service bindings are not imported.

Runtime Images transforms are available through a registered images binding in Wrangler. The same scoped transform API is exposed through env, c.env and imports from cloudflare:workers; account-wide hosted image storage is not exposed.

The Next.js SDK storage setup does not apply to these native handlers; use their env bindings. See Bindings for managing resources and Hono's context documentation for accessing them.

When a build fails

Check the selected app directory, the configured or conventional entrypoint, and the default export. A custom build must leave the configured Worker entrypoint available. Missing bindings, unsupported configuration and collisions with reserved bindings are reported before publication. See Troubleshooting.