Skip to content

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.

Namemodule-auth-go
Version0.1.0
Categorycomposable-modules
LicenseApache-2.0
Personaengineering
Tagsauth, middleware, jwt, go, security
Sourcetemplates/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

ToolVersionWhy
go>=1.24Go compilation and module management

Variables

Required

ProjectName string
Kebab-case project name, used as module 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 Composable authentication middleware with pluggable providers
Short project description for README
AuthProvider string — defaults to jwt
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.md

Composes with

Composites that use it