In Part 11 , I built a metrics system to see the big picture — request counts, latencies, error rates per endpoint. Then I looked at my main.go and realized something embarrassing. The JWT secret was hardcoded. The Redis address was a string literal. The rate limit was a magic number buried in middleware. Every config value was scattered across different files with no central source of truth. And then Redis went down during a test, and my entire backend froze. Every request hung for 5 seconds waiting for a timeout. The server was technically running but completely useless. Two problems. One week. Problem 1: Config Values Everywhere My main.go looked like this: err = db . InitDB ( "./data.db" ) err = redis . InitRedis ( "localhost:6379" ) // Somewhere in a handler file: secret := os . Getenv ( "JWT_SECRET" ) // Somewhere in middleware: maxRequests := 100 window := 60 * time . Second Enter fullscreen mode Exit fullscreen mode Four files. Four different patterns for reading config.…