Node.js / TypeScript
Package: chaos-proxy
npm install chaos-proxy
npx chaos-proxy --config chaos.yaml --verbose
chaos-proxy + chaos-proxy-go
chaos-proxy is a transport-level HTTP chaos proxy for injecting latency, failures, drops, throttling, and transforms. Both Node.js and Go versions share the same operational model: YAML config, ordered middleware chains, route matching, and runtime reload.
chaos-proxy runs as a standalone proxy process. You point your HTTP client at it instead of the real upstream, and it applies the chaos rules from a YAML config file before forwarding requests. Because it operates at the transport layer, it works for any HTTP client in any language - your app code does not need to change at all.
Language-agnostic
Any HTTP client - browser, Node.js, Go, Python, curl - can be routed through the proxy without code changes.
Hot-reload config
Send POST /reload to apply a new YAML config at runtime. No restart needed, chaos rules change instantly.
Ready-made presets
Ship with presets for common scenarios: mobile-3g, flaky-backend, burst-errors, timeout-storm. Start in seconds.
target is the upstream service chaos-proxy forwards to. port is where chaos-proxy itself listens - point your app or tests here instead of the real service.
target: "http://localhost:4000" # upstream to forward requests to
port: 5000 # chaos-proxy listens here
global:
- latency: 100 # add 100ms to every request
Global rules apply to all traffic. Route rules layer on top, matched by HTTP method and path pattern.
target: "http://localhost:4000"
port: 5000
global:
- failRandomly:
rate: 0.05 # 5% of all requests return 503
status: 503
routes:
"GET /users/:id":
- failNth:
n: 3 # every 3rd request to this route returns 500
status: 500
"POST /orders":
- latencyRange:
minMs: 500 # simulate variable upstream slowness
maxMs: 2000
# start with a ready-made mobile-3g simulation
npx chaos-proxy --config presets/mobile-3g.yaml --verbose
Run chaos-proxy alongside your app or test suite. Point your HTTP client at the proxy port instead of the real service. Because nothing in your app code changes, you can toggle chaos on and off just by changing which port you target, or by swapping configs at runtime.
npx chaos-proxy --config chaos.yaml --verbose
# was: http://localhost:4000
# now: http://localhost:5000
fetch('http://localhost:5000/users/123')
curl -X POST http://localhost:5000/reload
import { loadConfig, startServer } from 'chaos-proxy'
const server = await startServer(loadConfig('chaos.yaml'))
// run your tests against http://localhost:5000
await server.close()
Both versions share the same YAML config format and middleware model, so you can switch between them without changing your config files. The difference is runtime characteristics and how you install them.
| chaos-proxy (Node.js) | chaos-proxy-go | |
|---|---|---|
| Throughput | Good | ~2x higher - lower latency under load |
| Memory footprint | Higher (Node.js runtime) | Minimal - single binary, no runtime |
| Install | npm install chaos-proxy |
go build or download binary |
| Programmatic API | Yes - TypeScript | Yes - Go |
| Best for | JS/Node projects, quick start | High-load testing, polyglot teams, CI containers |
| Config format | Identical YAML | Identical YAML |
If you are already in a Node.js project, start with chaos-proxy. If you are running high-concurrency scenarios, running in a Docker container without Node.js, or testing a Go service, use chaos-proxy-go.
Package: chaos-proxy
npm install chaos-proxy
npx chaos-proxy --config chaos.yaml --verbose
Binary + Go API
go build -o chaos-proxy-go .
./chaos-proxy-go --config chaos.yaml --verbose
POST /reload