https://github.com/speakeasy-api/hono-openapi-example
An example repo for creating OpenAPI from a Hono App
https://github.com/speakeasy-api/hono-openapi-example
Last synced: 2 months ago
JSON representation
An example repo for creating OpenAPI from a Hono App
- Host: GitHub
- URL: https://github.com/speakeasy-api/hono-openapi-example
- Owner: speakeasy-api
- Created: 2024-11-01T11:41:04.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-08-04T20:49:03.000Z (4 months ago)
- Last Synced: 2025-09-16T08:57:06.366Z (3 months ago)
- Language: TypeScript
- Size: 130 KB
- Stars: 2
- Watchers: 4
- Forks: 4
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
Speakeasy Hono OpenAPI Example
This example Hono app demonstrates Speakeasy-recommended practices for creating clear OpenAPI specifications and SDKs.
This project was bootstrapped with the [Hono Node.js starter template](https://hono.dev/docs/getting-started/basic#starter). It has three example API endpoints in `src/routes/users/users.index.ts`, which can be used to get all users, get a user by id, and create a user.
## Prerequisites
You need to have [Node.js version >= 18](https://nodejs.org/) installed on your system to run this project.
To generate an SDK, you'll also need to [install Speakeasy CLI](https://github.com/speakeasy-api/speakeasy#installation) or use the Speakeasy dashboard.
## Installation
Install the application on your local machine.
1. Clone the repository:
```bash
git clone https://github.com/speakeasy-api/hono-openapi-example.git
```
2. Navigate into the directory:
```bash
cd hono-openapi-example
```
3. Install all dependencies for the application using NPM:
```bash
npm install
```
4. Install Speakeasy CLI:
```bash
brew install speakeasy-api/homebrew-tap/speakeasy
```
## Running the application
Start the server:
```bash
npm run start
```
### For development
You can use the provided script to run the application in development mode. It will detect any changes in the source code and automatically restart the server.
```bash
npm run dev
```
Before starting the dev server, move the `sdk-typescript` folder to a new location outside this project.
## Creating an OpenAPI specification
Run the following command to create an OpenAPI spec YAML file in your root folder:
```bash Terminal
npm run create:openapi
```
## Creating an SDK with Speakeasy
Run the following command to create a Speakeasy SDK:
```bash
speakeasy quickstart
```
## License
This project is licensed under the terms of the Apache 2.0 license.