API Gateway
Scaffolds an API gateway with edge routing, per-route auth and rate limiting, traffic management (canary splits, health checking), and per-upstream circuit breakers. Built on Hono with native fetch proxying, JWT/API key validation via jose, and OpenTelemetry instrumentation.
| Name | api-gateway |
| Version | 0.1.0 |
| Category | applications |
| License | Apache-2.0 |
| Persona | engineering |
| Tags | typescript, hono, api-gateway, proxy, rate-limit, auth |
| Source | templates/api-gateway |
Render it
Three front doors, one catalog. Pick whichever suits the caller.
# CLI
npx @nanohype/sdk render api-gateway --out ./my-app
# SDK
import { LocalSource, renderTemplate } from "@nanohype/sdk";
const result = await renderTemplate(source, "api-gateway", variables);
# MCP — from an agent
get_template({ name: "api-gateway" })Prerequisites
| Tool | Version | Why |
|---|---|---|
node | >=22 | Node.js runtime for the API gateway |
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 toAPI gateway with routing, auth, and rate limiting- Short project description for package.json and README
Frameworkstring — defaults tohono- HTTP framework (hono is default; extensible to express, fastify)
IncludeTestsbool — defaults totrue- Include test suite for gateway components
What it produces
28 files. Placeholder names such as __APP_NAME__ are what the renderer substitutes into.
.env.example
.gitignore
biome.json
package.json
src/gateway/__tests__/canary.test.ts
src/gateway/__tests__/matcher.test.ts
src/gateway/__tests__/proxy.test.ts
src/gateway/__tests__/rate-limit.test.ts
src/gateway/__tests__/registry.test.ts
src/gateway/bootstrap.ts
src/gateway/config.ts
src/gateway/index.ts
src/gateway/logger.ts
src/gateway/metrics.ts
src/gateway/middleware/auth.ts
src/gateway/middleware/cors.ts
src/gateway/middleware/rate-limit.ts
src/gateway/middleware/transform.ts
src/gateway/resilience/__tests__/circuit-breaker.test.ts
src/gateway/resilience/circuit-breaker.ts
src/gateway/router/matcher.ts
src/gateway/router/proxy.ts
src/gateway/router/types.ts
src/gateway/traffic/canary.ts
src/gateway/traffic/health.ts
src/gateway/types.ts
tsconfig.json
vitest.config.tsComposes with
- Pairs with
module-auth-ts - Pairs with
module-rate-limit-ts - Pairs with
module-cache-ts - Pairs with
k8s-deploy - Nests inside
monorepo