Skip to content

ritza-co/nestjs-openapi-example

 
 

Repository files navigation

Speakeasy Logo

Speakeasy NestJS OpenAPI example

This example NestJS app demonstrates the Speakeasy-recommended practices for generating clear OpenAPI documents and SDKs.

This project was bootstrapped with the NestJS-CLI.

Prerequisites

You need to have Node.js version 16+ and the Nest CLI installed on your system to run this project.

To generate an SDK, you'll also need to install the Speakeasy CLI or use the Speakeasy dashboard.

Installation

Install the application on your local machine.

  • Clone the repository:

    git clone https://github.com/speakeasy-api/nestjs-openapi-example.git
  • Navigate into the directory:

    cd speakeasy-nestjs-example
  • Install all the dependencies for the application using npm:

npm install
  • Install the Speakeasy CLI:

    brew install speakeasy-api/homebrew-tap/speakeasy

Running the application for development

You can use the provided script to run the application in development mode. It will watch for any changes in the source code and automatically restart the server.

Note: You need to move the sdk-typescript folder to a new location outside this project before starting the dev server.

npm run start:dev

Generating an OpenAPI document

When the development server is started, an OpenAPI document, openapi.yaml, is generated in the root directory using JS-YAML.

Generating an SDK using Speakeasy

Generate a Speakeasy SDK run using the following command:

speakeasy quickstart

License

This project is licensed under the terms of the Apache 2.0 license.

About

An example for generating OpenAPI from a NestJS app

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 98.5%
  • Other 1.5%