Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Edit: README #3

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 30 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,66 @@

<a href="[Speakeasy](https://speakeasyapi.dev/)">
<img src="https://github.com/speakeasy-api/speakeasy/assets/68016351/e959f81a-b250-4003-8c5c-a45b9463fc95" alt="Speakeasy Logo" width="400">
<h2>Speakeasy NestJS OpenAPI Example</h2>
<h2>Speakeasy NestJS OpenAPI example</h2>
</a>

</div>

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

This project was bootstrapped with [NestJS-CLI](https://docs.nestjs.com/cli/overview).
This project was bootstrapped with the [NestJS-CLI](https://docs.nestjs.com/cli/overview).

## 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](https://nodejs.org/) and [here](https://github.com/nestjs/nest-cli).
You need to have [Node.js version 16+](https://nodejs.org/) and the [Nest CLI](https://github.com/nestjs/nest-cli) installed on your system to run this project.

To generate an SDK, you'll also need the Speakeasy CLI installed, or use the Speakeasy dashboard.
To generate an SDK, you'll also need to [install the Speakeasy CLI](https://github.com/speakeasy-api/speakeasy#installation) or use the Speakeasy dashboard.

## Installation

To install the application on your local machine:
Install the application on your local machine.

1. Clone the repository:
```bash
git clone https://github.com/speakeasy-api/nestjs-openapi-example.git
```
- Clone the repository:

2. Navigate into the directory:
```bash
cd speakeasy-nestjs-example
```
```bash
git clone https://github.com/speakeasy-api/nestjs-openapi-example.git
```

3. Install all dependencies for the application using NPM:
```bash
npm install
```
- Navigate into the directory:

4. [Install Speakeasy CLI](https://github.com/speakeasy-api/speakeasy#installation):
```bash
brew install speakeasy-api/homebrew-tap/speakeasy
```
```bash
cd speakeasy-nestjs-example
```

- Install all the dependencies for the application using npm:

```bash
npm install
```

- Install the Speakeasy CLI:

```bash
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-typescript` folder to a new location outside this project before starting the dev server.
**Note:** You need to move the `sdk-typescript` folder to a new location outside this project before starting the dev server.

```bash
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 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

To generate a Speakeasy SDK run:
Generate a Speakeasy SDK run using the following command:

```bash
speakeasy quickstart
Expand Down