// Developer Tools & Infrastructure•2024•VerifiedPersonal Open Source
Honesty
Hono + Bun Minimal Screaming Architecture API Framework
// FIGURE 01SYSTEM INTERFACE SPECIMEN

Project at a Glance
- Problem: Ultra-lightweight routers like Hono are fast, but scaling them cleanly across growing APIs often leads to inconsistent file organization unless teams adopt a clear modular convention without the runtime overhead of a heavy enterprise framework.
- Deliverables: A minimalist Hono + Bun REST API boilerplate/framework inspired by NestJS ergonomics, implementing Minimal Screaming Architecture, custom TypeScript route and middleware decorators (
reflect-metadata), 3-tier middleware layering, Zod schema validation, and Drizzle ORM with MySQL (mysql2) migrations. - Core Stack: Hono 4, Bun, TypeScript, Drizzle ORM + Drizzle Kit, MySQL (
mysql2), Zod,reflect-metadata. - Practical Value: Built solo in late 2024 as a personal open-source exploration demonstrating how NestJS-style declarative routing and feature-module organization can be layered cleanly onto Hono and Bun.
Project Overview
Honesty is a lightweight, modular REST API framework starter running Hono on the Bun runtime. Inspired by the developer ergonomics of NestJS while staying close to Hono's minimal footprint, Honesty structures code by domain feature (Minimal Screaming Architecture) rather than scattering controllers, services, DTOs, and database entities across distant technical folders.
Every feature module (demonstrated by src/user/) collocates its own controller, service, dto, and entity files, while a small custom core (src/core/decorators/) wires declarative HTTP routes and middleware aliases directly into the Hono application instance.
Modular Architecture & Request Pipeline
+-------------------------------------------------------------+
| INCOMING HTTP REQUEST |
+------------------------------+------------------------------+
|
v
+-------------------------------------------------------------+
| TIER 1: GLOBAL HONO MIDDLEWARE (src/index.ts) |
+------------------------------+------------------------------+
|
v
+-------------------------------------------------------------+
| TIER 2: MODULE MIDDLEWARE via applyRoutes(app, Ctrl, []) |
+------------------------------+------------------------------+
|
v
+-------------------------------------------------------------+
| TIER 3: ROUTE-SPECIFIC @Middleware(['auth', 'role']) |
+------------------------------+------------------------------+
|
v
+-------------------------------------------------------------+
| FEATURE MODULE (e.g. src/user/) |
| Controller (@Get/@Post/@Put/@Delete) |
| -> DTO Validation (Zod) |
| -> Service Layer (Business Logic) |
| -> Entity Schema (Drizzle ORM -> MySQL) |
+-------------------------------------------------------------+
Core Engineering Highlights
1. Custom Decorator-Based Routing (src/core/decorators/route_decorator.ts)
- Implements
@Get,@Post,@Put, and@Deletemethod decorators backed byreflect-metadata. - Modules register cleanly into the Hono app in a single call via
applyRoutes(app, UserController, [moduleMiddleware]), keepingsrc/index.tsconcise and declarative.
2. Three-Tier Middleware & Alias Registry (src/middleware/)
- Supports Global middleware on the Hono root, Module-level middleware passed into
applyRoutes(), and Route-specific middleware declared directly above controller methods using@Middleware(['auth']). - Middleware aliases (
auth,role) are mapped centrally insrc/middleware/index.ts(middlewareAliases), making route protection readable and reusable across modules.
export class UserController {
@Get('user/:id')
@Middleware(['auth'])
public async show(ctx: Context) {
return ctx.json({ id: ctx.req.param('id') });
}
}
3. Minimal Screaming Architecture + Drizzle Kit Compatibility
- Each domain module owns its own
*.entity.tstable definitions (e.g.,src/user/user.entity.tsusingdrizzle-orm/mysql-core),*.dto.tsZod schemas,*.service.tsbusiness logic, and*.controller.tsHTTP handlers. - Because Drizzle Kit expects a unified schema entry point for SQL migration generation (
src/database/migrations/),src/database/schema.tssimply re-exports each feature module's entity (export * from '../user/user.entity'), preserving feature isolation without fighting Drizzle's tooling.