Negroni is a middleware library for Go that provides an idiomatic approach to composing HTTP handlers using the standard net/http package.
Negroni solves the problem of managing middleware chains in Go web applications without imposing a framework or introducing implicit behavior. It works by providing a lightweight handler composition system that explicitly chains middleware together, allowing each middleware to execute before and after the next handler in the chain. The library supports both custom middleware implementing the negroni.Handler interface and standard net/http.Handler implementations, giving developers flexibility in how they structure their middleware.
Negroni suits developers who want middleware composition without the "magic" of heavier frameworks. It is designed to work directly with net/http and is explicitly not a framework—it is middleware-focused and expects developers to bring their own router. The README contrasts it with Martini, noting that while Martini offers similar ideas, Negroni avoids excessive implicit behavior. For developers getting started, the tool provides negroni.Classic(), which bundles three commonly useful middleware: panic recovery, request/response logging, and static file serving. This makes it easy to bootstrap applications while remaining optional for those who prefer minimal defaults.
The project maintains active development with regular updates and demonstrates stability through comprehensive test coverage. The codebase shows consistent attention to code quality and reliability. Documentation is thorough, with translations available in multiple languages, and the project has been adopted in package repositories for distribution alongside standard Go tooling.