A lightweight, high-performance HTTP request router for Go with zero garbage allocation and explicit route matching.
HttpRouter is a high-performance HTTP request router for Go that scales efficiently with many routes and long paths. It solves the limitations of Go's default net/http mux by supporting variables in routing patterns, matching request methods, and providing explicit, unambiguous route matching. It uses a compressed radix tree data structure to achieve fast lookups and minimal memory overhead.
Go developers building web servers, RESTful APIs, or microservices that require fast, reliable routing with support for dynamic parameters and clean URL structures.
Developers choose HttpRouter for its exceptional performance, zero garbage allocation during matching, and predictable explicit routing that avoids common pitfalls like ambiguous matches. Its minimalistic design makes it easy to integrate with existing net/http handlers and middleware while providing essential features like panic recovery and automatic path correction.
A high performance HTTP request router that scales well
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Uses a compressed radix tree for efficient matching, resulting in low latency and minimal memory usage, with benchmarks cited in the README to back claims.
Eliminates ambiguous routing by ensuring each request matches exactly one route, improving predictability and SEO, as highlighted in the features section.
Automatically handles trailing slashes, case-insensitive redirects, and cleans superfluous path elements like ../ without extra configuration, enhancing user experience.
Generates no heap allocations during matching for parameter-free paths, optimizing performance for high-throughput applications as stated in the documentation.
Lacks integrated middleware, templating, or advanced web utilities, forcing developers to rely on external libraries or custom code for common functionalities.
Requires adapters or context wrappers to use standard http.Handler functions, adding complexity when integrating with existing net/http-based code.
Only supports named and catch-all parameters, with no built-in regex validation or custom matchers, which can be restrictive for complex routing needs.