← ClaudeAtlas

nethttp-architectlisted

Framework-specific delta on rest-api-architect — Go stdlib net/http (Go 1.22+ ServeMux, no router) on Go 1.27.3. Feature layout, struct-tag validation, RFC 9457 errors, JWT or IdP auth, graceful shutdown, OpenAPI via kin-openapi. Read rest-api-architect first for the cross-cutting REST conventions. Use when scaffolding or reviewing a stdlib net/http service.
ralvarez-ai/ralvaskills · ★ 4 · API & Backend · score 77
Install: claude install-skill ralvarez-ai/ralvaskills
# net/http Architecture Targets the stdlib **`net/http`** on **Go 1.27.3**, using the Go 1.22+ enhanced `ServeMux` (method matching, path variables, host matching) — no router framework. Companion to [go-architect](../../languages/go-architect/SKILL.md), [rest-api-architect](../../protocols/rest-api-architect/SKILL.md), and [sql-architect](../../databases/sql-architect/SKILL.md). Implementation skeletons in [RECIPES.md](RECIPES.md); pinned deps in [STACK.md](STACK.md). ## 1. Project structure — feature-based Same shape as `gin-architect` and `fastapi-architect`: one folder per bounded context under `internal/`, each with `handlers.go`, `service.go`, `repo.go`, `dto.go`, `queries/`. Full tree in [RECIPES.md](RECIPES.md). - **`handlers.go`** depends on `service.go`; never reaches into `repo.go` directly. - **`service.go`** is pure Go — no `net/http` imports. Easy to unit-test. - **`dto.go`** holds wire types; never reuse domain structs as DTOs. - **Keep the feature folder scannable, not minimal.** Split on a real responsibility seam, not a file count — a subfolder here is a new package (import path + exported surface). See [code-design-refactor §4](../../refactoring/code-design-refactor/SKILL.md#4-extract). ## 2. Routing — `http.ServeMux` with method patterns (Go 1.22+) The stdlib `ServeMux` supports method matching, path wildcards (`{id}`), and host matching. No third-party router needed. Registration skeleton in [RECIPES.md](RECIPES.md). - **Method patterns:** `"GET /v