Skip to main content
OpenAPI TypeScript provides comprehensive examples demonstrating integration with various frameworks, libraries, and HTTP clients. All examples use the Swagger Petstore API and include complete, working code.

Available Examples

Angular

Integration with Angular using @angular/common/http

React Query

React with TanStack Query for data fetching

Next.js

Next.js App Router with server and client components

Nuxt

Nuxt 3 with official @hey-api/nuxt plugin

Additional Framework Examples

The repository includes many more examples:
  • Vue - TanStack Query, Pinia Colada state management
  • Svelte - TanStack Svelte Query
  • HTTP Clients - Axios, Fetch, Ky, ofetch
  • Backend - Fastify server integration
  • OpenAI - OpenAI API integration

Example Structure

Each example includes:
  1. Configuration - openapi-ts.config.ts with framework-specific setup
  2. Generated Code - Type-safe clients, SDKs, and schemas
  3. Usage Examples - Real components showing API integration
  4. Complete Project - Runnable application with dependencies

Running Examples Locally

All examples are in the GitHub repository:
# Clone the repository
git clone https://github.com/hey-api/openapi-ts.git
cd openapi-ts

# Install dependencies
pnpm install

# Run a specific example
pnpm example angular dev
pnpm example react-query dev
pnpm example next dev
pnpm example nuxt dev

Regenerating Client Code

To regenerate the API client code for all examples:
pnpm examples:generate
This runs openapi-ts for each example based on their openapi-ts.config.ts configuration.

What’s Next?

Explore the framework-specific examples to see how to integrate OpenAPI TypeScript with your stack:

Angular Example

React Query Example

Next.js Example

Nuxt Example

Build docs developers (and LLMs) love