[{"data":1,"prerenderedAt":445},["ShallowReactive",2],{"project-honesty":3},{"id":4,"title":5,"body":6,"description":142,"extension":429,"meta":430,"navigation":440,"path":441,"seo":442,"stem":443,"__hash__":444},"content\u002Fprojects\u002Fhonesty.md","Honesty",{"type":7,"value":8,"toc":417},"minimark",[9,14,82,86,103,129,133,143,147,155,186,193,234,362,366,413],[10,11,13],"h2",{"id":12},"project-at-a-glance","Project at a Glance",[15,16,17,25,64,76],"ul",{},[18,19,20,24],"li",{},[21,22,23],"strong",{},"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.",[18,26,27,30,31,34,35,38,39,42,43,47,48,51,52,55,56,63],{},[21,28,29],{},"Deliverables:"," A minimalist ",[21,32,33],{},"Hono + Bun"," REST API boilerplate\u002Fframework inspired by ",[21,36,37],{},"NestJS"," ergonomics, implementing ",[21,40,41],{},"Minimal Screaming Architecture",", custom TypeScript route and middleware decorators (",[44,45,46],"code",{},"reflect-metadata","), 3-tier middleware layering, ",[21,49,50],{},"Zod"," schema validation, and ",[21,53,54],{},"Drizzle ORM"," with ",[21,57,58,59,62],{},"MySQL (",[44,60,61],{},"mysql2",")"," migrations.",[18,65,66,69,70,72,73,75],{},[21,67,68],{},"Core Stack:"," Hono 4, Bun, TypeScript, Drizzle ORM + Drizzle Kit, MySQL (",[44,71,61],{},"), Zod, ",[44,74,46],{},".",[18,77,78,81],{},[21,79,80],{},"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.",[10,83,85],{"id":84},"project-overview","Project Overview",[87,88,89,91,92,95,96,99,100,102],"p",{},[21,90,5],{}," is a lightweight, modular REST API framework starter running ",[21,93,94],{},"Hono"," on the ",[21,97,98],{},"Bun"," runtime. Inspired by the developer ergonomics of NestJS while staying close to Hono's minimal footprint, Honesty structures code by domain feature (",[21,101,41],{},") rather than scattering controllers, services, DTOs, and database entities across distant technical folders.",[87,104,105,106,109,110,113,114,113,117,120,121,124,125,128],{},"Every feature module (demonstrated by ",[44,107,108],{},"src\u002Fuser\u002F",") collocates its own ",[44,111,112],{},"controller",", ",[44,115,116],{},"service",[44,118,119],{},"dto",", and ",[44,122,123],{},"entity"," files, while a small custom core (",[44,126,127],{},"src\u002Fcore\u002Fdecorators\u002F",") wires declarative HTTP routes and middleware aliases directly into the Hono application instance.",[10,130,132],{"id":131},"modular-architecture-request-pipeline","Modular Architecture & Request Pipeline",[134,135,140],"pre",{"className":136,"code":138,"language":139},[137],"language-text","+-------------------------------------------------------------+\n|                 INCOMING HTTP REQUEST                       |\n+------------------------------+------------------------------+\n                               |\n                               v\n+-------------------------------------------------------------+\n|   TIER 1: GLOBAL HONO MIDDLEWARE (src\u002Findex.ts)             |\n+------------------------------+------------------------------+\n                               |\n                               v\n+-------------------------------------------------------------+\n|   TIER 2: MODULE MIDDLEWARE via applyRoutes(app, Ctrl, [])  |\n+------------------------------+------------------------------+\n                               |\n                               v\n+-------------------------------------------------------------+\n|   TIER 3: ROUTE-SPECIFIC @Middleware(['auth', 'role'])      |\n+------------------------------+------------------------------+\n                               |\n                               v\n+-------------------------------------------------------------+\n|   FEATURE MODULE (e.g. src\u002Fuser\u002F)                           |\n|   Controller (@Get\u002F@Post\u002F@Put\u002F@Delete)                      |\n|     -> DTO Validation (Zod)                                 |\n|     -> Service Layer (Business Logic)                       |\n|     -> Entity Schema (Drizzle ORM -> MySQL)                 |\n+-------------------------------------------------------------+\n","text",[44,141,138],{"__ignoreMap":142},"",[10,144,146],{"id":145},"core-engineering-highlights","Core Engineering Highlights",[148,149,151,152,62],"h3",{"id":150},"_1-custom-decorator-based-routing-srccoredecoratorsroute_decoratorts","1. Custom Decorator-Based Routing (",[44,153,154],{},"src\u002Fcore\u002Fdecorators\u002Froute_decorator.ts",[15,156,157,175],{},[18,158,159,160,113,163,113,166,120,169,172,173,75],{},"Implements ",[44,161,162],{},"@Get",[44,164,165],{},"@Post",[44,167,168],{},"@Put",[44,170,171],{},"@Delete"," method decorators backed by ",[44,174,46],{},[18,176,177,178,181,182,185],{},"Modules register cleanly into the Hono app in a single call via ",[44,179,180],{},"applyRoutes(app, UserController, [moduleMiddleware])",", keeping ",[44,183,184],{},"src\u002Findex.ts"," concise and declarative.",[148,187,189,190,62],{"id":188},"_2-three-tier-middleware-alias-registry-srcmiddleware","2. Three-Tier Middleware & Alias Registry (",[44,191,192],{},"src\u002Fmiddleware\u002F",[15,194,195,216],{},[18,196,197,198,201,202,205,206,120,209,212,213,75],{},"Supports ",[21,199,200],{},"Global"," middleware on the Hono root, ",[21,203,204],{},"Module-level"," middleware passed into ",[44,207,208],{},"applyRoutes()",[21,210,211],{},"Route-specific"," middleware declared directly above controller methods using ",[44,214,215],{},"@Middleware(['auth'])",[18,217,218,219,113,222,225,226,229,230,233],{},"Middleware aliases (",[44,220,221],{},"auth",[44,223,224],{},"role",") are mapped centrally in ",[44,227,228],{},"src\u002Fmiddleware\u002Findex.ts"," (",[44,231,232],{},"middlewareAliases","), making route protection readable and reusable across modules.",[134,235,239],{"className":236,"code":237,"language":238,"meta":142,"style":142},"language-typescript shiki shiki-themes github-light github-dark","export class UserController {\n  @Get('user\u002F:id')\n  @Middleware(['auth'])\n  public async show(ctx: Context) {\n    return ctx.json({ id: ctx.req.param('id') });\n  }\n}\n","typescript",[44,240,241,261,280,297,324,350,356],{"__ignoreMap":142},[242,243,246,250,253,257],"span",{"class":244,"line":245},"line",1,[242,247,249],{"class":248},"szBVR","export",[242,251,252],{"class":248}," class",[242,254,256],{"class":255},"sScJk"," UserController",[242,258,260],{"class":259},"sVt8B"," {\n",[242,262,264,267,270,273,277],{"class":244,"line":263},2,[242,265,266],{"class":259},"  @",[242,268,269],{"class":255},"Get",[242,271,272],{"class":259},"(",[242,274,276],{"class":275},"sZZnC","'user\u002F:id'",[242,278,279],{"class":259},")\n",[242,281,283,285,288,291,294],{"class":244,"line":282},3,[242,284,266],{"class":259},[242,286,287],{"class":255},"Middleware",[242,289,290],{"class":259},"([",[242,292,293],{"class":275},"'auth'",[242,295,296],{"class":259},"])\n",[242,298,300,303,306,309,311,315,318,321],{"class":244,"line":299},4,[242,301,302],{"class":248},"  public",[242,304,305],{"class":248}," async",[242,307,308],{"class":255}," show",[242,310,272],{"class":259},[242,312,314],{"class":313},"s4XuR","ctx",[242,316,317],{"class":248},":",[242,319,320],{"class":255}," Context",[242,322,323],{"class":259},") {\n",[242,325,327,330,333,336,339,342,344,347],{"class":244,"line":326},5,[242,328,329],{"class":248},"    return",[242,331,332],{"class":259}," ctx.",[242,334,335],{"class":255},"json",[242,337,338],{"class":259},"({ id: ctx.req.",[242,340,341],{"class":255},"param",[242,343,272],{"class":259},[242,345,346],{"class":275},"'id'",[242,348,349],{"class":259},") });\n",[242,351,353],{"class":244,"line":352},6,[242,354,355],{"class":259},"  }\n",[242,357,359],{"class":244,"line":358},7,[242,360,361],{"class":259},"}\n",[148,363,365],{"id":364},"_3-minimal-screaming-architecture-drizzle-kit-compatibility","3. Minimal Screaming Architecture + Drizzle Kit Compatibility",[15,367,368,395],{},[18,369,370,371,374,375,378,379,382,383,386,387,390,391,394],{},"Each domain module owns its own ",[44,372,373],{},"*.entity.ts"," table definitions (e.g., ",[44,376,377],{},"src\u002Fuser\u002Fuser.entity.ts"," using ",[44,380,381],{},"drizzle-orm\u002Fmysql-core","), ",[44,384,385],{},"*.dto.ts"," Zod schemas, ",[44,388,389],{},"*.service.ts"," business logic, and ",[44,392,393],{},"*.controller.ts"," HTTP handlers.",[18,396,397,398,401,402,382,405,408,409,412],{},"Because ",[21,399,400],{},"Drizzle Kit"," expects a unified schema entry point for SQL migration generation (",[44,403,404],{},"src\u002Fdatabase\u002Fmigrations\u002F",[44,406,407],{},"src\u002Fdatabase\u002Fschema.ts"," simply re-exports each feature module's entity (",[44,410,411],{},"export * from '..\u002Fuser\u002Fuser.entity'","), preserving feature isolation without fighting Drizzle's tooling.",[414,415,416],"style",{},"html pre.shiki code .szBVR, html code.shiki .szBVR{--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sScJk, html code.shiki .sScJk{--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .sVt8B, html code.shiki .sVt8B{--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sZZnC, html code.shiki .sZZnC{--shiki-default:#032F62;--shiki-dark:#9ECBFF}html pre.shiki code .s4XuR, html code.shiki .s4XuR{--shiki-default:#E36209;--shiki-dark:#FFAB70}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":142,"searchDepth":263,"depth":263,"links":418},[419,420,421,422],{"id":12,"depth":263,"text":13},{"id":84,"depth":263,"text":85},{"id":131,"depth":263,"text":132},{"id":145,"depth":263,"text":146,"children":423},[424,426,428],{"id":150,"depth":282,"text":425},"1. Custom Decorator-Based Routing (src\u002Fcore\u002Fdecorators\u002Froute_decorator.ts)",{"id":188,"depth":282,"text":427},"2. Three-Tier Middleware & Alias Registry (src\u002Fmiddleware\u002F)",{"id":364,"depth":282,"text":365},"md",{"subtitle":431,"slug":432,"client":433,"year":434,"role":435,"category":436,"technologies":437},"Hono + Bun Minimal Screaming Architecture API Framework","honesty","Personal Open Source",2024,"Solo Developer","Developer Tools & Infrastructure",[94,98,438,54,50,439],"TypeScript","MySQL",true,"\u002Fprojects\u002Fhonesty",{"title":5,"description":142},"projects\u002Fhonesty","cNUW4xHk4b8cNv708PG2xmP6TbrRK2RZeJX07KQCfQE",1796006983865]