Go HTTP Service
Scaffolds a Go HTTP service using chi v5 for routing, structured middleware (logging, panic recovery), a repository-pattern database layer with PostgreSQL and SQLite implementations, Viper-based configuration, and OpenTelemetry instrumentation. Includes graceful shutdown with signal handling, a Makefile, GitHub Actions CI, and optional Docker support. Auth-neutral — stack `module-auth-go` alongside when you need authentication.
| Name | go-service |
| Version | 0.1.0 |
| Category | applications |
| License | Apache-2.0 |
| Persona | engineering |
| Tags | go, chi, api, service, rest |
| Source | templates/go-service |
Render it
Three front doors, one catalog. Pick whichever suits the caller.
# CLI
npx @nanohype/sdk render go-service --out ./my-app
# SDK
import { LocalSource, renderTemplate } from "@nanohype/sdk";
const result = await renderTemplate(source, "go-service", variables);
# MCP — from an agent
get_template({ name: "go-service" })Prerequisites
| Tool | Version | Why |
|---|---|---|
go | >=1.26 | Go compilation and module management |
Variables
Required
ProjectNamestring- Kebab-case project name, used as binary name and directory Must be lowercase kebab-case starting with a letter.
GoModulestring- Full Go module path Must be a valid Go module path.
Orgstring- GitHub organization or username Must be a valid GitHub org or username.
Optional
Descriptionstring — defaults toA Go HTTP service- Short project description for help text and README
Databasestring — defaults topostgres- Default database backend
IncludeDockerbool — defaults totrue- Include Dockerfile and docker-compose.yml
What it produces
35 files. Placeholder names such as __APP_NAME__ are what the renderer substitutes into.
.env.example
.github/workflows/ci.yml
.gitignore
.golangci.yml
cmd/server/main.go
docker-compose.yml
Dockerfile
go.mod
go.sum
internal/config/config_test.go
internal/config/config.go
internal/handler/error_paths_test.go
internal/handler/example.go
internal/handler/handler_test.go
internal/handler/health.go
internal/handler/readyz.go
internal/middleware/logger.go
internal/middleware/max_body.go
internal/middleware/middleware_test.go
internal/middleware/recovery.go
internal/middleware/request_id.go
internal/repository/interface.go
internal/repository/postgres_test.go
internal/repository/postgres.go
internal/repository/sqlite_test.go
internal/repository/sqlite.go
internal/service/example_test.go
internal/service/example.go
internal/telemetry/telemetry_test.go
internal/telemetry/telemetry.go
load-test/k6/config.json
load-test/k6/script.js
load-test/README.md
Makefile
README.mdComposes with
- Pairs with
eval-harness - Pairs with
module-auth-go - Pairs with
k8s-deploy - Nests inside
monorepo
Composites that use it
- Go Microservice — Go HTTP service with observability and deployment.