NestJS v11
WARNING
NestJS plugin is currently in beta. The interface might change before it becomes stable. We encourage you to leave feedback on GitHub.
About
Nest is a progressive Node.js framework for building efficient, reliable and scalable server-side applications.
The NestJS plugin for Hey API generates type-safe controller method signatures from your OpenAPI spec, fully compatible with all core features.
Collaborators
Features
- NestJS v11 support
- seamless integration with
@hey-api/openapi-tsecosystem - type-safe controller methods
- minimal learning curve thanks to extending the underlying technology
Installation
In your configuration, add nestjs to your plugins and you'll be ready to generate NestJS artifacts. 🎉
export default {
input: 'hey-api/backend', // sign up at app.heyapi.dev
output: 'src/client',
plugins: [
// ...other plugins
'nestjs',
],
};Output
The NestJS plugin will generate the following artifacts, depending on the input specification.
Controller Methods
Operations are grouped by their first tag into separate types.
export type PetsControllerMethods = {
createPet: (body: CreatePetData['body']) => Promise<CreatePetResponse>;
listPets: (query?: ListPetsData['query']) => Promise<ListPetsResponse>;
showPetById: (path: ShowPetByIdData['path']) => Promise<ShowPetByIdResponse>;
};
export type StoreControllerMethods = {
getInventory: () => Promise<GetInventoryResponse>;
};import { Body, Controller, Get, Param, Post, Query } from '@nestjs/common';
import type { PetsControllerMethods } from '../client/nestjs.gen';
import type { CreatePetData, ListPetsData, ShowPetByIdData } from '../client/types.gen';
@Controller('pets')
export class PetsController implements Pick<
PetsControllerMethods,
'createPet' | 'listPets' | 'showPetById'
> {
@Post()
async createPet(@Body() body: CreatePetData['body']) {}
@Get()
async listPets(@Query() query?: ListPetsData['query']) {}
@Get(':petId')
async showPetById(@Param() path: ShowPetByIdData['path']) {}
}API
You can view the complete list of options in the UserConfig interface.
Examples
You can view live examples on StackBlitz or on GitHub.
Sponsors
Partners behind the future of API tooling. Become a sponsor.
Gold

Best-in-class developer interfaces for your API.
stainless.comThe open source coding agent.
opencode.ai

