Core Reference
@routa-ts/core provides the route definition helpers and runtime primitives used by Routa applications and generated code.
Install
Section titled “Install”pnpm add @routa-ts/core hono zodBasic Usage
Section titled “Basic Usage”import { createRoute, defineRoute } from "@routa-ts/core";
export default defineRoute({ get: createRoute({ responses: { success: { status: 200, }, }, run: async () => { return { ok: true }; }, }),});Route contracts keep HTTP behavior explicit in source: inputs, responses, middleware, metadata, and handler boundaries live together.
Business logic remains application-owned. Routa owns the HTTP boundary.
Main APIs
Section titled “Main APIs”createRouta(config): preserves the app runtime configuration.defineRoute(config): defines methods and route-file middleware for one route file.createRoute(contract): preserves a method contract with typed input, responses, middleware, and handler output.createMiddleware(contract): defines middleware requirements, provided context, rejects, and runtime behavior.createRouteRoot(path): binds a route file to generated route context types.createHonoApp(routes, options): creates the Hono runtime app from generated route metadata.