Skip to content

Shared validation

Routes declare wire validation once. Codegen gives the frontend the same types and a schemas map of named runtyp preds so forms and RPC stay in sync.

WhatWhereWho uses it
RPC methodsspec({ routes })Server + generated ApiClient
Shared domain entitiesschemas/ (or similar) — Product, User, …Imported by route input / output
Route-specific wire shapesRoute file — IDs, filters, one-off wrappersThat route’s generated {Route}Input / output types + schemas.{route}Input
Shared UI slicesspec({ exports })Filters, modals — schemas.product, type Product
UI-only fieldsConsumer appNever in the spec

Share domain preds like Product across routes; keep method-specific shapes (e.g. { id } lookup input) in the route file. exports is optional — register shared preds when the frontend should import them by name from schemas.

Composition inside a route input does not auto-export the slice — list it under exports when consumers need that name.

Powered by runtyp: preds validate on the server and serialize to JSON Schema for docs, OpenAPI, MCP, and codegen.

One command writes client + schemas — see SDK generation. Example layout: Server layout.