Full NestJS Starter Kit — Part 5 API Documentation & Client Code Generation

Andrew Larsen
8 min readJan 25, 2024

In this series of articles we’re walking through how to create a NestJS starter kit to use for your cloud applications. In our previous article we walked through how to setup observability in our app via logging, tracing, and metrics.

In this article we’ll setup our starter kit to expose documentation of our APIs via Swagger & OpenAPI. Additionally, we’ll generate typescript client code that can be leveraged by our front end applications.

If you are interested in learning more about what we do at Compoze Labs, please reach out!

connect@compozelabs.com

OpenAPI & Swagger

OpenAPI is an open source standard for describing RESTful APIs. It is intended for both human and machine readability. On top of this documentation, we can leverage tools to generate clickable documentation (Swagger UI) and generate actual source code to call our APIs with. We’ll walk through configuring Swagger and generating client code!

Configuring Swagger

NestJS offers first class support for swagger which makes the initial setup easy. First, install the NestJS module:

pnpm install @nestjs/swagger

--

--