Skip to content

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.

Nameapi-gateway
Version0.1.0
Categoryapplications
LicenseApache-2.0
Personaengineering
Tagstypescript, hono, api-gateway, proxy, rate-limit, auth
Sourcetemplates/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

ToolVersionWhy
node>=22Node.js runtime for the API gateway

Variables

Required

ProjectName string
Kebab-case project name, used as package name and directory Must be lowercase kebab-case starting with a letter.

Optional

Description string — defaults to API gateway with routing, auth, and rate limiting
Short project description for package.json and README
Framework string — defaults to hono
HTTP framework (hono is default; extensible to express, fastify)
IncludeTests bool — defaults to true
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.ts

Composes with