Skip to content

Swagger

Nest 10 / 11 / 12 · Node 22+ / Bun 1.4+

@nestjs/swagger works with both adapters:

import { DocumentBuilder, SwaggerModule } from "@nestjs/swagger";
app.setGlobalPrefix("v1");
const document = SwaggerModule.createDocument(
app,
new DocumentBuilder().setTitle("My API").setVersion("1").build(),
);
SwaggerModule.setup("docs", app, document, { useGlobalPrefix: true });

This serves /v1/docs/, /v1/docs-json, and /v1/docs-yaml, including local Swagger UI scripts and styles. Describe DTO properties with @ApiProperty() and uploads with @ApiConsumes("multipart/form-data") / @ApiBody(). The Swagger CLI plugin is untested.