Did you know github.com/go-chi maintains useful middleware in separate repositories? Here's a list.
Please, post other useful third party middleware and packages in the comments!
Auth
| Repo |
What it's for |
Recommended |
| jwtauth |
JWT verification middleware on top of lestrrat-go/jwx/v3, puts claims in request context |
⭐⭐⭐⭐ |
| oauth |
OAuth 2.0 server middleware — issues tokens, not just verifies |
⭐ |
Rate limiting & request coalescing
| Repo |
What it's for |
Recommended |
| httprate |
Rate-limiter middleware based on Cloudflare's efficient sliding window pattern |
⭐⭐⭐⭐⭐ |
| httprate-redis |
Redis backend for httprate, for multi-instance setups |
⭐⭐⭐⭐⭐ |
| stampede |
Cache-stampede protection, coalesces identical requests |
⭐⭐⭐⭐ |
| httpcoala |
Request coalescing — archived, use stampede |
⭐ |
Observability
| Repo |
What it's for |
Recommended |
| httplog/v3 |
Structured request logging via log/slog |
⭐⭐⭐⭐⭐ |
| metrics |
OpenMetrics/Prometheus interface, middleware and handler |
⭐⭐⭐⭐⭐ |
| requestid |
Propagates Request-Id header across services |
⭐⭐⭐⭐⭐ |
| telemetry |
Prometheus middleware, predates metrics |
⭐⭐⭐ |
| traceid |
Propagates Trace-Id header across services, predates requestid |
⭐⭐⭐ |
| httptracer |
OpenTracing middleware, unmaintained since 2021 |
⭐⭐ |
Request/response handling
| Repo |
What it's for |
Recommended |
| cors |
CORS middleware, a fork of github.com/rs/cors |
⭐⭐⭐⭐ |
| render |
Decode request bodies, encode JSON/XML responses |
⭐⭐⭐ |
| jsonp |
JSONP callback wrapping, legacy |
⭐ |
Routing & server lifecycle
| Repo |
What it's for |
Recommended |
| hostrouter |
Route by Host header to different routers |
⭐⭐⭐ |
| valve |
Graceful shutdown via context signalling |
⭐⭐ |
Client-side middleware
| Repo |
What it's for |
Recommended |
| transport |
Client-side middleware for http.Client — retries, auth, logging |
⭐⭐⭐⭐ |
Tooling & misc
| Repo |
What it's for |
Recommended |
| webrpc |
Schema-driven approach to writing web APIs, think gRPC powered by Go templates and JSON |
⭐⭐⭐⭐⭐ |
| typeid |
Prefixed, base32-encoded, k-sortable identifiers for Go. Inspired by Stripe API IDs and the TypeID spec. |
⭐⭐⭐⭐⭐ |
| docgen |
Generate route docs (JSON/Markdown) from a chi router |
⭐⭐⭐ |
| community-examples |
Empty stub, skip |
⭐ |