finds.dev

julienschmidt/httprouter

A high performance HTTP request router that scales well

View on GitHubHomepage ↗

★ 17,136GoBSD-3-Clauseupdated Jul 2024

// the take

httprouter is a radix-tree based HTTP router for Go that trades flexibility for speed. It's the router under the hood of Gin and a dozen other frameworks, so if you've used Go web development, you've probably already relied on it indirectly. For people building their own lightweight HTTP layer without a full framework, this is the obvious starting point.

The radix tree implementation is genuinely fast — benchmarks consistently put it ahead of alternatives, and the zero-allocation path for parameterless routes is a real design win. The constraint that routes must be explicit (no ambiguous pattern overlap) forces API designers to be deliberate, which usually produces cleaner route structures. Built-in 405 Method Not Allowed and automatic OPTIONS handling saves boilerplate. The codebase is tiny — five files, easy to read and audit.

The custom handler signature `func(w, r, Params)` means any middleware written for the standard `http.Handler` interface needs an adapter shim, which creates friction when mixing third-party middleware. No route groups or subrouters — organizing a large API means manually prefixing every path string, or reaching for a wrapper library. The project has been essentially unmaintained since 2023 with open issues and PRs sitting unreviewed; Go 1.22's improved built-in `net/http` ServeMux (with method and wildcard support) now covers most of the original motivation for this router, so the delta has narrowed considerably.

We read the README, the directory tree and a key source file in July 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
17,136
Forks
1,462
Language
Go
License
BSD-3-Clause
Last commit
22 Jul 2024

// nearby

If httprouter isn't quite it.

All repos →