Skip to main content

@ltv/cwb

Production-ready Hono + OpenAPI APIs on Cloudflare Workers: envelopes, errors, logging, KV caching and multi-tenant Drizzle D1

bun add @ltv/cwb hono chanfana zod

A typed, documented API in a few lines

src/index.ts
import {createApp, defineModule} from '@ltv/cwb';
import {fromHono, OpenAPIRoute} from 'chanfana';
import type {Context} from 'hono';

class Hello extends OpenAPIRoute {
handle(c: Context) {
return c.respond({message: 'Hello from Workers'});
}
}

export default createApp({
modules: [defineModule({version: 1, routes: {'GET /hello': Hello}})],
openApi: (app) => fromHono(app, {docs_url: '/docs'}),
});