Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Go
  3. httptreemux

httptreemux

MITGov5.5.0

A high-speed, flexible tree-based HTTP router for Go with relaxed routing rules and wildcard support.

GitHubGitHub
619 stars59 forks0 contributors

What is httptreemux?

httptreemux is a tree-based HTTP router for Go designed for high-speed routing with flexible pattern matching. It solves the need for efficient URL routing in web applications by allowing overlapping wildcard and static routes, making it easier to design complex routing logic without sacrificing performance.

Target Audience

Go developers building web servers or APIs that require fast and flexible URL routing, especially those who need overlapping route patterns or efficient tree-based matching.

Value Proposition

Developers choose httptreemux for its relaxed routing rules, which allow a path segment to be a wildcard in one route and static in another, combined with near-httprouter performance and built-in concurrency safety for route management.

Overview

High-speed, flexible tree-based HTTP router for Go.

Use Cases

Best For

  • Building high-performance REST APIs in Go
  • Implementing complex URL patterns with overlapping wildcards
  • Creating routing groups for API versioning or prefixes
  • Developing web servers that require efficient tree-based route matching
  • Handling trailing slash redirects and canonical URL management
  • Writing middleware-friendly routers with context support

Not Ideal For

  • Projects requiring the absolute fastest router performance, as benchmarks show it's slightly slower than httprouter
  • Teams needing built-in middleware or extensive framework integrations out-of-the-box
  • Applications where active maintenance and security updates are critical, since the project is explicitly not maintained
  • Use cases relying on specific behaviors from other routers, like automatic query string modification as in gorilla/pat

Pros & Cons

Pros

Flexible Route Patterns

Allows overlapping wildcards and static tokens in different routes, enabling complex URL designs without conflicts, as shown in the routing rules examples.

Efficient Tree-Based Matching

Uses a patricia tree for high-speed URL routing, inspired by httprouter, with performance close to it in benchmarks.

Routing Group Organization

Supports creating clusters of routes with shared prefixes via NewGroup, making API versioning or path management cleaner.

Context and Handler Support

Compatible with Go's context package and http.HandlerFunc through UsingContext or NewContextMux, facilitating modern middleware integration.

Concurrency Safety

Includes an RWMutex for safe route addition from multiple goroutines when SafeAddRoutesWhileRunning is enabled, as detailed in the concurrency section.

Cons

No Longer Maintained

The README warns that the project is not maintained, risking unpatched bugs and lack of updates for new Go versions or features.

Slightly Slower Performance

Benchmarks indicate it's close to but slower than httprouter, making it less ideal for edge cases where every nanosecond counts.

Limited Built-in Features

Light on features; lacks built-in middleware and has unexpected differences, such as no automatic query string modification like gorilla/pat.

Complex Escaped Slash Handling

Requires careful configuration with PathSource and EscapeAddedRoutes to properly handle URLs with escaped characters, adding setup complexity.

Frequently Asked Questions

Quick Stats

Stars619
Forks59
Contributors0
Open Issues8
Last commit2 years ago
CreatedSince 2014

Tags

#high-performance#api-server#http#golang#http-router#web-framework#url-routing#go#router#middleware

Built With

G
Go

Included in

Go169.1k
Auto-fetched 4 hours ago

Related Projects

ChiChi

lightweight, idiomatic and composable router for building Go HTTP services

Stars22,991
Forks3,620
Last commit5 days ago
muxmux

Package gorilla/mux is a powerful HTTP router and URL matcher for building Go web servers with 🦍

Stars21,836
Forks1,892
Last commit2 years ago
httprouterhttprouter

A high performance HTTP request router that scales well

Stars17,138
Forks1,465
Last commit2 years ago
webweb

Go Router + Middleware. Your Contexts.

Stars1,525
Forks117
Last commit6 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub