Skip to content

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.

Namego-service
Version0.1.0
Categoryapplications
LicenseApache-2.0
Personaengineering
Tagsgo, chi, api, service, rest
Sourcetemplates/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

ToolVersionWhy
go>=1.26Go compilation and module management

Variables

Required

ProjectName string
Kebab-case project name, used as binary name and directory Must be lowercase kebab-case starting with a letter.
GoModule string
Full Go module path Must be a valid Go module path.
Org string
GitHub organization or username Must be a valid GitHub org or username.

Optional

Description string — defaults to A Go HTTP service
Short project description for help text and README
Database string — defaults to postgres
Default database backend
IncludeDocker bool — defaults to true
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.md

Composes with

Composites that use it