Skip to content
/ hono-starter Public template

🚀 hono-starter - A Typescript API with Node + Hono + Drizzle + MySQL + BullMQ

License

Notifications You must be signed in to change notification settings

Joker666/hono-starter

Repository files navigation

Hono Starter

A Hono starter boilerplate for TypeScript with minimal dependencies and a clean architecture. All dependencies are initiated at the start of the application and passed to the controllers and services. A swagger API doc is attached in the static folder: openapi.yaml.

API Doc powered by Swagger UI

Screenshot 2024-09-28 at 12 48 21 AM

Database browser powered by Drizzle Studio

Screenshot 2024-09-28 at 12 46 26 AM

Stack

  • Authentication: JWT
  • Validation: Zod
  • Worker: BullMQ
  • Logging: Pino
  • ORM: Drizzle
  • Queue: Redis
  • DB: MySQL
  • Runtime: NodeJS
  • Framework: Hono
  • API Doc: Swagger
  • Formatter: Prettier
  • Language: TypeScript
  • Package Manager: PNPM

Install dependencies

pnpm install
pnpm install -g pino-pretty

Migration

Create a new file .env in the root folder and copy contents from the .env.template file.

docker compose up -d

Generate

pnpm run db:generate

Migrate

pnpm run db:migrate

Run the app

pnpm run dev
open http://localhost:3000/doc

API Doc

The OpenAPI YAML doc is in the static folder.

If you need the JSON file, it can be generated with the help of yq.

https://github.com/mikefarah/yq

yq eval -o=json static/openapi.yaml > static/openapi.json

And the JSON doc will be generated.

Drizzle Studio For Database Browsing

pnpm drizzle-kit studio
open https://local.drizzle.studio/