Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

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

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Go
  3. web

web

MITGov1.1

A Go mux and middleware package that provides statically typed contexts and fast, scalable routing.

GitHubGitHub
1.5k stars117 forks0 contributors

What is web?

gocraft/web is a Go router and middleware package for building web applications. It provides a fast, tree-based router with O(log(N)) routing performance and emphasizes type safety through custom contexts, allowing developers to pass strongly typed data between middleware and handlers.

Target Audience

Go developers building web applications who need a performant, type-safe router with flexible middleware composition and nested routing capabilities.

Value Proposition

Developers choose gocraft/web for its combination of high performance (adding as little as 3-10μs latency), static typing via custom contexts, and a clean API that integrates seamlessly with Go's standard net/http package.

Overview

Go Router + Middleware. Your Contexts.

Use Cases

Best For

  • Building web applications where type safety and performance are critical, such as high-traffic APIs or services.
  • Creating hierarchical web applications with distinct sections (e.g., admin areas, API routes) that require different middleware and context structures.
  • Implementing middleware chains that need to pass strongly typed data (like user sessions or access tokens) between handlers.
  • Developing applications with many routes where O(log(N)) routing scalability is necessary to maintain low latency.
  • Integrating with existing Go net/http ecosystems while adding structured routing and middleware features.
  • Handling complex routing needs with path parameter capture, regex validation, and wildcard matching.

Not Ideal For

  • Projects requiring built-in HTTP/2 or WebSocket support without additional middleware
  • Teams that prefer full-stack frameworks with integrated templating, ORM, and auto-generated API docs
  • Applications where optional path segments are critical, as it requires defining multiple routes manually

Pros & Cons

Pros

Blazing Fast Performance

Benchmarks show added latency of only 3-10μs per request with O(log(N)) routing scalability, as tracked in BENCHMARK_RESULTS, ensuring low overhead for high-traffic apps.

Statically Typed Contexts

Enables passing strongly typed data between middleware and handlers using custom structs, improving code safety and reducing runtime errors compared to dynamic maps.

Flexible Nested Routers

Supports hierarchical routing with different contexts and middleware for distinct app sections, like admin areas or APIs, allowing clean separation of concerns.

Seamless net/http Integration

Works directly with Go's standard http package, including http.ResponseWriter and http.Request, making it easy to integrate into existing Go ecosystems.

Cons

Limited Path Parameter Flexibility

Does not support optional path segments or regexps outside segments, requiring multiple route definitions for variations, as admitted in the README.

Sparse Built-in Middleware

Ships with only basic middleware (logger, error show, static files), forcing reliance on community contributions or custom code for advanced features like JSON binding.

Complex Context Hierarchy

Nested routers require careful embedding of parent contexts in structs, which can lead to boilerplate and increased cognitive load for setup and maintenance.

Frequently Asked Questions

Quick Stats

Stars1,524
Forks117
Contributors0
Open Issues19
Last commit5 years ago
CreatedSince 2013

Tags

#http-server#static-typing#mux#web-framework#go#router#context-handling#middleware#performance

Built With

G
Go

Included in

Go169.1k
Auto-fetched 17 hours ago

Related Projects

ChiChi

lightweight, idiomatic and composable router for building Go HTTP services

Stars22,573
Forks1,136
Last commit18 days ago
muxmux

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

Stars21,831
Forks1,889
Last commit1 year ago
httprouterhttprouter

A high performance HTTP request router that scales well

Stars17,131
Forks1,463
Last commit2 years ago
BoneBone

Lightning Fast HTTP Multiplexer

Stars1,284
Forks101
Last commit7 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