Design your client in goway
summary
A small HTTP client library replaces a monolithic client with composable middleware and a tiny interface around the Do method, letting logging, basic auth middleware, metrics, retries/backoff and simple random load‑balancing be stacked via a middleware chain. Tests drop in‑process servers and just assert request headers or logging, so features are verifiable without heavy setup. Applied across a codebase of ~250k LOC, 70 microservices and 40 engineers, the approach works in production and eases injection of tracing and instrumentation.
AI-written summary · about
chapters (10)
- 0:00Introduction to Juna
- 0:51Engineering culture at Juna
- 2:22Clean code and design goals
- 4:29The challenge of scalability
- 5:42The problem with monolithic HTTP
- 10:20Middleware and modular design
- 16:16Implementing the chain pattern
- 18:38Best practices for Go code
- 22:14Closing thoughts and wisdom
- 23:30Q&A session
