nirn-proxy
GitHubHighly available, transparent HTTP proxy that handles Discord ratelimits for you and exports Prometheus metrics.
nirn-proxy sits between your Discord bot clients and the Discord REST API, handling ratelimits transparently across fleets of bots. It supports unlimited clients, works with any API version, and requires no hardcoded routes. Just point your library at the proxy and go.
The Problem
Discord's rate limits are notoriously complex: per-route, per-resource, with global limits and unpredictable bucket boundaries. When you're running multiple bot instances (or multiple bots entirely), each instance makes independent decisions that can cascade into 429 storms and temporary bans.
The Solution
nirn-proxy acts as a centralized gateway that:
- → Coordinates globally: Proxy instances form a cluster using SWIM protocol, routing requests consistently by bucket hash
- → Queues intelligently: Requests wait in-proxy rather than hammering Discord and getting rejected
- → Scales horizontally: Deploy multiple proxy instances; they discover each other and coordinate automatically
- → Stays transparent: Clients send requests as if talking to Discord directly; the proxy handles the rest
Observability
Prometheus metrics are exported out of the box: request latencies by route and status, open connections, error counters, and cluster routing stats. Pair with nirn-probe for edge health monitoring.