Auth Middleware Module
Composable authentication middleware module with pluggable providers. Ships with reference implementations for JWT, Clerk, Auth0, Supabase, and API key validation. The provider registry pattern makes it trivial to add custom auth strategies. Middleware is compatible with both Hono and Express request handlers.
| Name | module-auth-ts |
| Version | 0.1.0 |
| Category | composable-modules |
| License | Apache-2.0 |
| Persona | engineering |
| Tags | auth, middleware, jwt, typescript, security |
| Source | templates/module-auth-ts |
Render it
Three front doors, one catalog. Pick whichever suits the caller.
# CLI
npx @nanohype/sdk render module-auth-ts --out ./my-app
# SDK
import { LocalSource, renderTemplate } from "@nanohype/sdk";
const result = await renderTemplate(source, "module-auth-ts", variables);
# MCP — from an agent
get_template({ name: "module-auth-ts" })Prerequisites
| Tool | Version | Why |
|---|---|---|
node | >=22 | Node.js runtime for the auth module |
Variables
Required
ProjectNamestring- Kebab-case project name, used as package name and directory Must be lowercase kebab-case starting with a letter.
Optional
Descriptionstring — defaults toComposable authentication middleware with pluggable providers- Short project description for package.json and README
AuthProviderstring — defaults tojwt- Default auth provider to use (jwt, clerk, auth0, supabase, apikey, or a custom name)
What it produces
27 files. Placeholder names such as __APP_NAME__ are what the renderer substitutes into.
.env.example
.gitignore
biome.json
package.json
README.md
src/auth/__tests__/error-paths.test.ts
src/auth/__tests__/guards.test.ts
src/auth/__tests__/jwt.test.ts
src/auth/__tests__/registry.test.ts
src/auth/bootstrap.ts
src/auth/guards.ts
src/auth/index.ts
src/auth/middleware.ts
src/auth/providers/apikey.ts
src/auth/providers/auth0.ts
src/auth/providers/clerk.ts
src/auth/providers/index.ts
src/auth/providers/jwt.ts
src/auth/providers/mock.ts
src/auth/providers/registry.ts
src/auth/providers/supabase.ts
src/auth/providers/types.ts
src/auth/resilience/__tests__/circuit-breaker.test.ts
src/auth/resilience/circuit-breaker.ts
src/auth/types.ts
tsconfig.json
vitest.config.tsComposes with
- Pairs with
ts-service - Pairs with
mcp-server-ts - Nests inside
monorepo
Composites that use it
- AI Chatbot — Full-stack AI chatbot with agentic loop, HTTP service, authentication, evaluation harness, and deployment..
- AI Platform — Full AI platform with HTTP service, LLM gateway, vector store, data pipeline, auth, billing, and monitoring.
- AI Web Application — Full-stack web application with Next.js frontend, RAG pipeline, authentication, database, and deployment..
- Document Intelligence — Document search and question-answering system with RAG pipeline, HTTP service, file storage, database, and deployment..
- Enterprise AI Infrastructure — Full enterprise AI stack with agents, tool servers, safety guardrails, evaluation, prompt management, observability, and Kubernetes deployment..
- Multi-Agent System — Multi-agent architecture with A2A protocol peers, MCP tool servers, and an orchestrating agent.
- Product Launch — Full product launch kit spanning engineering, design, QA, product, marketing, and operations.
- Production API Service — Production-grade TypeScript API service with auth, database, caching, rate limiting, background jobs, observability, and deployment..
- RAG-Powered Agent — AI agent that uses retrieval-augmented generation as a tool.