Skip to main content

@apical-ts/craft

Strictly-typed client and server from OpenAPI to Typescript with Zod v4 validation

CLI
npx @apical-ts/craft generate \
-i https://petstore.swagger.io/v2/swagger.json \
-o ./generated \
--generate-server \
--generate-client
TypeScript
import { findPetsByStatus } from './generated/operations/findPetsByStatus.js';
const r = await findPetsByStatus({
query: { status: "available" },
});
if (r.isValid === true && r.status === 200) {
// Zod v4 parsed payload
console.log(r.parsed[0].name);
}
  • Modular & Tree-shakable

    Import only what you need. No bloat, minimal dependencies, no dead code.

  • Performance

    Bring your own validator: choose Zod v4 for runtime validation, swap in your own library, or skip validation entirely.

  • Type-Safe by Design

    All schemas are fully typed. Supports multiple success status codes (2xx) and multiple content-types for both requests and responses.

  • Efficient error handling

    Provides discriminated unions for errors that can occur at different stages, such as during network requests or payload validation. Client calls never throw.