Adapters
Hono
ESM-only Hono v4 adapter.
// Hono v4 is ESM-only — run with: npx tsx hono-app.js
import { Hono } from 'hono';
import { serve } from '@hono/node-server';
import { honoAdapter } from 'doctreen/hono';
const app = new Hono();
app.get('/users', (c) => c.json([]));
// Can be called before or after routes
honoAdapter(app, { meta: { title: 'My API', version: '1.0.0' } });
serve({ fetch: app.fetch, port: 3000 });Mount order
Either order works. honoAdapter adds a GET route at docsPath; on the first
request to the docs page, app.routes is read and all routes registered by
that time are shown.
Runtime validation caveat
When using validate: true, the adapter middleware must run before your
routes — Hono's middleware does not retro-apply. If your routes are mounted
before the adapter and validation is on, the validation middleware skips them.
Schema resolution order
defineRoutedeclaration- JSDoc inside the handler function