openapi-ts
OpenAPI-to-TypeScript code generator producing production-grade SDKs, Zod schemas, and TanStack Query hooks.
Repository Health
Technical Analysis
openapi-ts (@hey-api/openapi-ts) is the flagship code generator of the Hey API ecosystem, turning any OpenAPI specification into typed, production-ready TypeScript: fully-typed request/response models, SDK client functions, Zod validation schemas, and framework hooks such as TanStack Query — via a plugin architecture with 20+ official plugins covering HTTP clients (Fetch, Axios, Angular, Next.js, Nuxt), validation libraries (Zod, Valibot, ArkType), and mock/faker data generation.
It runs as a CLI or programmatic Node.js API driven by an openapi-ts.config.ts file, and is used in production by companies including Vercel, PayPal, AWS, and Autodesk according to the project’s README, with millions of weekly npm downloads.
What You Get
- A CLI and programmatic Node.js API for generating TypeScript code from any OpenAPI specification
- 20+ official plugins covering HTTP clients (Fetch, Axios, Angular, Next.js, Nuxt), validators (Zod, Valibot, ArkType), and TanStack Query hooks
- Fully typed request/response models and SDK client functions generated directly from the spec
- A config-file-driven (
openapi-ts.config.ts) workflow that supports custom plugin composition - Optional sync integration with the Hey API Registry for centralized spec management
Common Use Cases
- Generating a fully typed TypeScript SDK for a backend API directly from its OpenAPI/Swagger spec
- Producing Zod validation schemas alongside generated types to validate API responses at runtime
- Wiring generated SDK calls into TanStack Query hooks for React/Vue/Angular data-fetching layers
- Keeping frontend and backend types in sync automatically as part of a CI pipeline that regenerates code on spec changes
Under The Hood
Architecture - openapi-ts is one package within the larger hey-api/hey-api Turborepo/pnpm monorepo; internally, src/generate.ts and src/generate/ drive the generation pipeline, src/plugins/ implements the 20+ pluggable output targets (SDK clients, Zod schemas, TanStack Query hooks, etc.), src/ts-compiler/src/ts-dsl provide a TypeScript AST-building layer used to emit generated code, and src/config parses and validates the openapi-ts.config.ts file that drives a run. src/contracts and src/symbols manage the intermediate representation shared across plugins as they consume the parsed OpenAPI spec. Tech Stack - TypeScript throughout, targeting Node.js 22+; the monorepo uses pnpm workspaces, Turborepo for build orchestration, and Vitest for testing, with a companion @hey-api/codegen-core package supplying shared AST/codegen primitives used across both the TypeScript and Python generators in the same monorepo. Code Quality - Extensive __tests__ directories at both the monorepo root and within packages/openapi-ts, GitHub Actions CI (badge referenced in the README), Renovate-managed dependency updates, and a CLAUDE.md contributor guide tailored for AI coding agents all point to a professionally maintained, actively developed codebase. API Design - The plugin architecture is the key design choice: rather than hard-coding output formats, openapi-ts exposes a plugin contract that both official and third-party plugins implement, so adding a new client library or validator target doesn’t require forking the core generator — this is reflected in the config file simply listing which plugins to run.
Used by 14 apps in this directory
Tianji
Analytics · Monitoring
Replace Google Analytics, UptimeKuma, and Prometheus with one self-hosted platform that tracks websites, monitors uptime, and reports server health.
Tracecat
AI Agents · Automation · Security
Open-source agentic security automation platform that runs AI agents and durable workflows at scale with sandboxed execution.
Trieve
AI Development · Developer Tools · Search
All-in-one self-hostable platform for hybrid search, RAG, recommendations, and analytics built on Rust and Qdrant.
Umbraco CMS
CMS
The friendly open-source .NET CMS that gives developers full control over content, structure, and delivery without lock-in.
Windmill
Automation · Developer Tools
Turn scripts into webhooks, workflows, and auto-generated UIs — the fastest self-hostable workflow engine, 13x faster than Airflow.