Skip to content

Example REST API using Hono, Bun, Turso, Drizzle, Resend, and Zod

Notifications You must be signed in to change notification settings

hebobibun/hono-bun-starter

Repository files navigation

Hono Bun Starter

A minimal starter template for building web applications using Hono & Bun. Implemented with a clean Layered Architecture.

Designed for scalable and maintainable backend development with clear separation of concerns across Presentation, Application, Domain, and Infrastructure layers.

We're using

  • 🚀 Web Framework: Hono
  • 🧊 Runtime & Package Manager: Bun
  • 💾 Database: Turso (Serverless SQLite)
  • 🛠️ ORM: Drizzle
  • 📧 Email Service: Resend
  • 🔐 Validation: Zod

Project Structure

.
├── documentation
│   ├── address.md
│   ├── contact.md
│   └── user.md
├── migrations
│   ├── 0000_peaceful_tiger_shark.sql
│   └── meta
├── src
│   ├── application
│   │   ├── services
│   │   │   ├── contact-service.ts
│   │   │   └── user-service.ts
│   │   └── validation
│   │       ├── auth-validation.ts
│   │       ├── contact-validation.ts
│   │       └── user-validation.ts
│   ├── domain
│   │   └── model
│   │       ├── contact-model.ts
│   │       └── user-model.ts
│   ├── infrastructure
│   │   ├── database
│   │   │   ├── index.ts
│   │   │   └── schema.ts
│   │   ├── external
│   │   │   └── mail-sender.ts
│   │   ├── logging
│   │   │   └── logger.ts
│   │   └── repositories
│   │       ├── auth-repository.ts
│   │       ├── contact-repository.ts
│   │       └── user-repository.ts
│   ├── presentation
│   │   ├── middleware
│   │   │   └── auth-middleware.ts
│   │   └── routers
│   │       ├── contact-router.ts
│   │       └── user-router.ts
│   └── index.ts
├── test
│   ├── result
│   ├── contact-test.ts
│   └── user-test.ts
├── .env
├── bun.lockb
├── drizzle.config.ts
├── package.json
├── README.md
└── tsconfig.json

How to run

To install dependencies:

bun install

Copy .env.example to .env and fill in the values

cp .env.example .env

Generate and migrate database schema

bun db:gen
bun db:migrate

To run:

bun run dev

How to test

To run tests:

bun test ./test/user-test.ts
bun test ./test/contact-test.ts 

About

Example REST API using Hono, Bun, Turso, Drizzle, Resend, and Zod

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published