Speakeasy NestJS OpenAPI Example
An example for generating OpenAPI from a NestJS app
README
<h2>Speakeasy NestJS OpenAPI Example</h2>
This example NestJS app demonstrates Speakeasy-recommended practices for generating clear OpenAPI specifications and SDKs.
This project was bootstrapped with NestJS-CLI.
Prerequisites
You need to have Node.js version >= 16 and the Nest CLI installed on your system to run this project. If you don't have these installed, you can download them from here and here.
To generate an SDK, you'll also need the Speakeasy CLI installed, or use the Speakeasy dashboard.
Installation
To 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 dependencies for the application using NPM:
npm install -
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.
Move the
sdk-typescriptfolder to a new location outside this project before starting the dev server.
npm run start:dev
Creating an OpenAPI specification
An OpenAPI specification openapi.yaml file is generated in the root directory, using JS-YAML, when the development server is started.
Generating an SDK using Speakeasy
To generate a Speakeasy SDK run:
speakeasy quickstart
License
This project is licensed under the terms of the Apache 2.0 license.
