MIT 0 runtime dependencies node ≥ 20 v1.0.0

The API gateway
for Node.js.

Pure TypeScript on native node:http. No framework, no runtime dependencies. Just a radix tree and a keep-alive pool. 52 features in one process: routing, auth, caching, rate limits, circuit breaking, metrics.

quickstart
npm install typescript-gateway
npx tsgate init .
npx tsgate start
curl http://localhost:8088/health
request log 1 req/s

simulated stream · the scale matches the loopback benchmark below

request lifecycle

Six stages, socket to response.

  1. 01 ACCEPT request hits the socket. zero allocations on the way in.
  2. 02 MATCH radix tree resolves method + path in O(log n).
  3. 03 POLICIES inbound chain: auth, cache, rate limit. first Response wins.
  4. 04 FORWARD keep-alive agent selected from the pool, request forwarded.
  5. 05 RESILIENCE circuit breaker wraps the hop. open means fail fast.
  6. 06 RESPOND transform, compress, write. context returns to the pool.
runtime deps
0
hot path p99
5ms
features
52
tests
1086 ✓

capability index

Everything a proxy needs.

core routing
  • Radix Router
  • Reverse Proxy
  • Request Pipeline
  • Context Pool
  • WebSocket Tunneling
  • OpenAPI Generator
  • Disconnect Propagation
  • Request Coalescing
  • Streaming Path
resilience
  • Circuit Breaker
  • Retry Manager
  • Health Checker
  • Fallback Handler
  • Timeout Manager
traffic control
  • Rate Limiter
  • Response Cache
  • Load Balancer
payload
  • Body Parser
  • Request Transformer
  • Response Transformer
  • Compression
observability
  • Metrics Histogram
  • Structured Logger
  • Performance Dashboard
  • Access Log Sampling
  • CPU & Memory Profiler
operations
  • Config Loader & Validator
  • Plugin Execution Chain
  • Auto Tuner
identity & security
  • JWT Auth
  • API Keys
  • Upstream Credential Injection
  • RFC 7807 Problem Details

Every capability ships with unit and integration coverage in the repo. Details in the feature matrix.

benchmarks

Overhead, with the receipts.

ScenarioDirect upstreamThrough tsgateΔ
Sustained 100 conn × 60 s 55,369 req/s 53,081 req/s −4.1%
Plain GET /api/bench 78,498 req/s 50,323 req/s −35.9%
Large body, gzip 20,068 req/s 12,903 req/s −35.7%
Slow upstream, 200 ms 49 req/s 49 req/s −0%
Slow 100 ms + cacheable 98 req/s 30,677 req/s ~313×
Failing upstream (500) 77,120 req/s 28,178 req/s −63.5% fail-fast

macOS arm64 · Node v22.21.1 · loopback · 2026-10-05. The fast-path tax is proxy parse/socket cost in JavaScript; it disappears on latency-bound upstreams and inverts with the response cache. Full method and caveats: testing & benchmarks.

seo & performance

Audited for zero-latency execution.

Zero Runtime Dependencies

Built entirely on native Node.js APIs and radix trees without external library bloat or security surface area.

Pure TypeScript Architecture

Strict TypeScript codebase ensuring type safety across middleware chains, routing, and configuration.

Edge & Node Compatibility

Designed for high-throughput execution in modern Node.js runtimes and edge-compatible serverless environments.

Zero-Config Deployment

Single JSON configuration file with intelligent defaults for routing, proxying, caching, and resilience.

documentation

Read the manual.

Seluruh panduan juga tersedia dalam Bahasa Indonesia.

Start routing.

One JSON file. One process. Nothing to install at runtime. Everything else has sensible defaults.