[{"data":1,"prerenderedAt":85},["ShallowReactive",2],{"blog-\u002Fblog\u002Fexplicit-boundaries":3},{"id":4,"title":5,"author":6,"body":7,"category":74,"date":75,"description":76,"extension":77,"meta":78,"navigation":79,"path":80,"readingTime":81,"seo":82,"stem":83,"__hash__":84},"blog\u002Fblog\u002Fexplicit-boundaries.md","Why explicit boundaries matter in Go","Amir Mohammad Kargar",{"type":8,"value":9,"toc":68},"minimark",[10,15,19,27,31,34,44,47,51,54],[11,12,14],"h2",{"id":13},"start-with-a-business-interface","Start with a business interface",[16,17,18],"p",{},"An HTTP handler understands status codes, request binding and response schemas. A business service understands a use case. Keeping these responsibilities separate makes it possible to introduce another transport without rewriting the use case.",[16,20,21,22,26],{},"In Gonex, business services live in ",[23,24,25],"code",{},"modules\u002FNAME\u002Fservice.go",". Small interfaces belong to the code that consumes them. The database implementation and transport mapping remain adapters around that core.",[11,28,30],{"id":29},"one-module-several-adapters","One module, several adapters",[16,32,33],{},"A module can register HTTP routes and manage resources. Generated modules expose an injectable service; generated registries construct one service shared across its adapters. This makes composition explicit and avoids scanning source at runtime.",[35,36,42],"pre",{"className":37,"code":39,"language":40,"meta":41},[38],"language-text","modules\u002Fusers\u002F\n├── module.go\n├── service.go\n└── http\u002F\n    ├── handlers.go\n    ├── schemas.go\n    ├── routes.go\n    └── openapi.go\n","text","",[23,43,39],{"__ignoreMap":41},[16,45,46],{},"HTTP versions can have independent adapters. Versioned Protobuf messages can map into the same domain values. A repository interface can be implemented in memory or with GORM.",[11,48,50],{"id":49},"resource-ownership-is-part-of-architecture","Resource ownership is part of architecture",[16,52,53],{},"Connections and background work need an owner. Gonex resources expose start and close operations. Dependencies register before consumers and close in reverse order. Cancellation must be cooperative; a lifecycle API cannot safely stop arbitrary background work that ignores its context.",[16,55,56,57,62,63,67],{},"Continue with ",[58,59,61],"a",{"href":60},"\u002Fdocs\u002Fmain\u002Fmodules\u002F","modules and lifecycle"," and the ",[58,64,66],{"href":65},"\u002Fdocs\u002Fmain\u002Fapi-reference\u002F","application API reference"," for the concrete contracts.",{"title":41,"searchDepth":69,"depth":69,"links":70},2,[71,72,73],{"id":13,"depth":69,"text":14},{"id":29,"depth":69,"text":30},{"id":49,"depth":69,"text":50},"Architecture","2026-10-20","Modules, adapters, and a business core that does not depend on a transport.","md",{},true,"\u002Fblog\u002Fexplicit-boundaries",1,{"title":5,"description":76},"blog\u002Fexplicit-boundaries","slgvpiWYNkLfR_jxlM3HewaBVGJqp9rUhl7IgzybWXw",1792521640214]