Skip to content
App
Markdown

Deploy Hono

Deploy a Hono app on Pilvia App as it is — Hono's app is already the fetch handler the platform runs, and c.env is the platform's env.

Hono runs on Pilvia App unchanged. A Hono app has a fetch(request, env) method, which is exactly the shape the platform runs, so export default app is the whole integration. The platform's env arrives as Hono's c.env, and its ctx as c.executionCtx, so c.executionCtx.waitUntil(promise) finishes work after the response.

Tested with Hono 4.13 on 2026-11-20.

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

type Env = { Bindings: { kv: any; user: any } };
const app = new Hono<Env>();

app.get("/", (c) => c.html("<h1>Hello from Hono</h1>"));
app.get("/api/time", (c) => c.json({ now: new Date().toISOString() }));
app.get("/posts/:slug", (c) => c.text(`post: ${c.req.param("slug")}`));

app.post("/guestbook", async (c) => {
  const { name } = await c.req.parseBody();
  if (!name) return c.text("name required", 400);
  const list = (await c.env.kv.get("guestbook", "json")) ?? [];
  await c.env.kv.put("guestbook", [String(name), ...list].slice(0, 20));
  return c.redirect("/guestbook", 303);
});

export default app;
pilvia.app.json
{
  "name": "my-api",
  "auth": "public",
  "kv": true,
  "entry": "src/index.ts"
}
pilvia app deploy

pilvia app deploy bundles the entry with bun, TypeScript included. There is no separate build step.

Notes

  • Static files: declare "assets": "public" in the manifest instead of Hono's serveStatic. The host serves those files before your app runs, with strong ETags, and a request for one never starts an isolate.
  • c.env carries what the manifest grants: env.kv and env.cache, env.user and the data bindings.
  • Smaller pieces: if you only need a few endpoints beside a static site, server functions do it without a framework.

What was tested

An HTML page formatting a date with Intl in fi-FI, a JSON route, a route parameter, Hono's own 404, and a form POST read with parseBody that writes to env.kv and redirects with a 303. The bundle was 55 KB.

Type to search. ↑↓ to move, Enter to open, Esc to close.