Skip to content

An example repo for creating OpenAPI from a Hono App

Notifications You must be signed in to change notification settings

ritza-co/hono-openapi-example

 
 

Repository files navigation

Speakeasy

Speakeasy

Build APIs your users love ❤️ with Speakeasy



Speakeasy Hono OpenAPI example

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

This project was bootstrapped with the Hono Node.js starter template. It has three example API endpoints in src/routes/users/users.index.ts, which can be used to get all users, to get a user by ID, and to create a user.

Prerequisites

You need to have Node.js version 18+ 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/hono-openapi-example.git
  • Navigate into the directory:

    cd hono-openapi-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

Start the server:

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.

npm run dev

Before starting the dev server, move the sdk-typescript folder to a new location outside of this project.

Generating an OpenAPI document

Run the following command to generate an OpenAPI document in the form of a YAML file in your root folder:

npm run create:openapi

Generating an SDK with Speakeasy

Run the following command to generate a Speakeasy SDK:

speakeasy quickstart

License

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

About

An example repo for creating OpenAPI from a Hono App

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 98.5%
  • Other 1.5%