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.
npm install typescript-gateway
npx tsgate init .
npx tsgate start
curl http://localhost:8088/health simulated stream · the scale matches the loopback benchmark below
request lifecycle
Six stages, socket to response.
- 01 ACCEPT request hits the socket. zero allocations on the way in.
- 02 MATCH radix tree resolves method + path in O(log n).
- 03 POLICIES inbound chain: auth, cache, rate limit. first Response wins.
- 04 FORWARD keep-alive agent selected from the pool, request forwarded.
- 05 RESILIENCE circuit breaker wraps the hop. open means fail fast.
- 06 RESPOND transform, compress, write. context returns to the pool.
capability index
Everything a proxy needs.
- Radix Router
- Reverse Proxy
- Request Pipeline
- Context Pool
- WebSocket Tunneling
- OpenAPI Generator
- Disconnect Propagation
- Request Coalescing
- Streaming Path
- Circuit Breaker
- Retry Manager
- Health Checker
- Fallback Handler
- Timeout Manager
- Rate Limiter
- Response Cache
- Load Balancer
- Body Parser
- Request Transformer
- Response Transformer
- Compression
- Metrics Histogram
- Structured Logger
- Performance Dashboard
- Access Log Sampling
- CPU & Memory Profiler
- Config Loader & Validator
- Plugin Execution Chain
- Auto Tuner
- 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.
| Scenario | Direct upstream | Through 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.