KosmoJS generates an OpenAPI 3.1 specification directly from your route definitions.
Route structure, TypeScript types, VRefine constraints, parameters, responses - all reflected in the spec automatically. No manual schema authoring, no annotation layers.
Enable OpenAPI
Simply add it to your source folder's kosmo.config.ts:
ts
import { defineConfig } from "@kosmojs/dev";
export default defineConfig({
backend: {
stack: "hono",
base: "/api",
openapi: {
outfile: "openapi.json",
openapi: "3.1.0",
info: { title: "My API", version: "1.0.0" },
servers: [{ url: "https://api.example.com/api" }],
},
},
});