A lightweight, high-performance HTTP request muxer for Go, built on httprouter with net/context support.
Xmux is a lightweight HTTP request multiplexer for Go that combines the speed of httprouter with net/context support. It routes HTTP requests efficiently using a radix tree, stores parameters in context, and provides features like automatic trailing slash correction and explicit route matching.
Go developers building high-performance web services or APIs who need fast, context-aware routing with minimal overhead.
Developers choose Xmux for its near-zero allocation performance, seamless integration with Go's context package, and clean separation of routing logic from handler parameters.
xmux is a httprouter fork on top of xhandler (net/context aware)
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Ensures each request matches exactly one route, eliminating ambiguity and improving SEO, as highlighted in the README's 'Only explicit matches' feature.
Generates zero heap allocations for parameter-free paths and uses a radix tree for efficient matching, benchmarked to outperform routers like Chi and Goji.
Stores route parameters in Go's context package, enabling cleaner middleware chaining without extra handler parameters, a core design philosophy.
Handles trailing slashes and case insensitivity automatically, redirecting users to correct URLs without manual intervention, as described in the Path auto-correction section.
Cannot register both static and parameterized routes for the same path segment, restricting flexible routing patterns that other muxers allow.
Parameters are only accessible via context, making it incompatible with standard http.Handler functions without adapters, limiting backward compatibility.
Focuses solely on routing; middleware and other web framework features must be added separately via xhandler or third-party packages, increasing setup complexity.