Skip to main content
OpenAPI TypeScript provides plugins for popular web frameworks, generating type-safe server and client code tailored to each framework’s conventions.

Available Frameworks

Angular

Generate HTTP requests and resources for Angular applications

Fastify

Generate type-safe route handlers for Fastify servers

How Framework Plugins Work

Framework plugins analyze your OpenAPI specification and generate code that integrates seamlessly with your chosen framework:
  1. Type Generation - Creates TypeScript types for requests, responses, and parameters
  2. Framework Integration - Generates code using framework-specific patterns and APIs
  3. Type Safety - Ensures compile-time type checking for your API implementation
  4. Developer Experience - Provides autocomplete and inline documentation

Choosing a Framework Plugin

Angular Plugin

Use the @angular/common plugin when building Angular applications. It generates:
  • HTTP Requests - HttpRequest instances for use with Angular’s HTTP client
  • HTTP Resources - Resource APIs using Angular’s new httpResource API
  • Injectable Services - Classes decorated with @Injectable for dependency injection
Requires Angular 18+ for httpResource support. Use httpRequests for older versions.

Fastify Plugin

Use the fastify plugin when building Fastify servers. It generates:
  • Route Handlers - Type-safe handler signatures matching your API operations
  • Request Typing - Body, query, path, and header parameter types
  • Response Typing - Success and error response types

Common Configuration

All framework plugins support standard plugin options:
openapi-ts.config.ts
import { defineConfig } from '@hey-api/openapi-ts';

export default defineConfig({
  input: 'path/to/openapi.yaml',
  output: {
    path: './src/client',
  },
  plugins: [
    {
      name: 'framework-plugin',
      // Framework-specific options here
    },
  ],
});

Standard Options

includeInEntry
boolean
default:false
Whether to export generated code from the main index.ts entry file.
comments
boolean
default:true
Whether to include JSDoc comments in generated code.

Next Steps

Angular Integration

Learn how to use the Angular plugin

Fastify Integration

Learn how to use the Fastify plugin

Build docs developers (and LLMs) love