Auth Middleware Module (Go)
Composable authentication middleware module for Go HTTP services with pluggable providers. Ships with reference implementations for JWT (HS256/RS256 with JWKS), Auth0, Clerk, Supabase, and API key validation. The provider registry pattern makes it trivial to add custom auth strategies. Middleware is compatible with chi, gorilla/mux, and any net/http-based router.
| Name | module-auth-go |
| Version | 0.1.0 |
| Category | composable-modules |
| License | Apache-2.0 |
| Persona | engineering |
| Tags | auth, middleware, jwt, go, security |
| Source | templates/module-auth-go |
Render it
Three front doors, one catalog. Pick whichever suits the caller.
# CLI
npx @nanohype/sdk render module-auth-go --out ./my-app
# SDK
import { LocalSource, renderTemplate } from "@nanohype/sdk";
const result = await renderTemplate(source, "module-auth-go", variables);
# MCP — from an agent
get_template({ name: "module-auth-go" })Prerequisites
| Tool | Version | Why |
|---|---|---|
go | >=1.24 | Go compilation and module management |
Variables
Required
ProjectNamestring- Kebab-case project name, used as module 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 toComposable authentication middleware with pluggable providers- Short project description for README
AuthProviderstring — defaults tojwt- Default auth provider (jwt, auth0, clerk, supabase, apikey, or a custom name)
What it produces
25 files. Placeholder names such as __APP_NAME__ are what the renderer substitutes into.
.env.example
.gitignore
auth/auth_test.go
auth/auth.go
auth/guards_test.go
auth/guards.go
auth/middleware_test.go
auth/middleware.go
auth/providers/apikey_test.go
auth/providers/apikey.go
auth/providers/auth0.go
auth/providers/clerk.go
auth/providers/constructors_test.go
auth/providers/errors.go
auth/providers/jwt_test.go
auth/providers/jwt.go
auth/providers/provider.go
auth/providers/register.go
auth/providers/registry_test.go
auth/providers/resolver.go
auth/providers/supabase.go
go.mod
go.sum
Makefile
README.mdComposes with
- Pairs with
go-service - Nests inside
monorepo
Composites that use it
- Go Microservice — Go HTTP service with observability and deployment.