API & contracts
Your route types are the source of truth. camelon extracts them into an OpenAPI spec and a runtime validation artifact in one pass.
camelon openapi
This writes two files into src/gen/:
openapi.json— the OpenAPI spec, built from every route'sLoaderInput/OutputandActionInput/Output.route-contracts.json— the ajv schemas the runtime uses to validate incoming requests.
You never write the spec by hand. The route's types on the left become the live API docs on the right — Swagger UI, served by the service worker. Its "Try it out" calls the route, also handled by the worker.
import type { RouteArgs } from 'camelon';
export type LoaderInput = { query: { q?: string } };
export type LoaderOutput = { hits: number };
export function loader({ query }: RouteArgs) {
return { hits: (query.q ?? '').length * 3 };
}The spec's title, version, and description come from your package.json:
{
"name": "my-api",
"version": "1.0.0",
"description": "Public endpoints"
}
Validate
camelon validate checks the whole route tree without importing a single route: naming, collisions, export shapes, and the type contracts. Run it in CI.
camelon validate
Swagger UI
In dev, the spec is served at /dev/api-docs with a Swagger UI. It updates as you edit route types.