Skip to content

Routa

Routa is a schema-first, OpenAPI-aware REST framework for new TypeScript APIs.

Route files define inputs, responses, middleware, metadata, and handler boundaries. From that contract, Routa can generate typed handlers, runtime validation, and OpenAPI. Routa can also start from an OpenAPI file and scaffold the first version of the source contract.

  1. Create a new project.

    Terminal window
    pnpm create routa-ts@latest
  2. Define route contracts in src/routes.

  3. Use Routa to check, build, run, and keep OpenAPI aligned.

Routa v0 is intentionally narrow:

  • Hono runtime
  • Zod schemas
  • OpenAPI .yaml, .yml, and .json input
  • OpenAPI-to-source scaffolding
  • Source-to-OpenAPI checking
  • Typed route responses
  • Minimal typed middleware context

Quickstart

Create a project and run the first local Routa API.

Project anatomy

Learn the files Routa owns and the files your app owns.

Route contracts

Learn the source-of-truth model for Routa HTTP boundaries.

Scaffold from OpenAPI

Generate route files from an OpenAPI document.

Routa routes are filesystem-backed. Folders map to URL segments, and each route.ts file owns the methods for that path.

src/routes/users/route.ts
src/routes/users/$id/route.ts

Each method is declared as a route contract:

export default defineRoute({
post: createRoute({
input: {
body: CreateUserSchema,
},
responses: {
success: {
status: 201,
schema: UserSchema,
},
},
run: async ({ input, ctx }) => {
return users.createUser(input.body, ctx);
},
}),
});

Handlers return named outcomes from the declared response map. Business logic stays in application-owned services, modules, use cases, or domain code. Routa owns the HTTP boundary: routing, validation, middleware context, typed responses, and OpenAPI.