NetLife Guru

Open source Go packages for fast, maintainable web systems. Built with a documentation-first approach.

Product
OverviewGolang packagesNews
Documentation
DocumentationGo LoggerGo RouterGo DB Form
Company
OverviewContactNewsGitHub
Community / Support
Supportinfo@netlife.guru
© 2026 NetLife Guru. All rights reserved.
GitHubinfo@netlife.guru
NetLife GuruNetLife GuruNetLife Guru
NetLife GuruNetLife GuruNetLife Guru
OverviewDocumentationNewsSupportContact

Golang packages

About
Router

About

NLG HTTP Router

router is a production-oriented HTTP routing package for Go focused on performance, composability, and clean application structure.

It combines radix-tree based route matching with middleware pipelines, hierarchical route grouping, request-scoped context utilities, recovery handling, rate limiting, profiling support, static asset serving, and multi-server orchestration in a lightweight API built on top of Go’s standard net/http interfaces.

Features

  • Zero-Allocation Route Matching: Static, wildcard, parameterized, and mounted route lookups run with 0 B/op and 0 allocs/op in benchmarks.
  • Fast Radix Router: Optimized radix-tree based route lookup for static, wildcard, and parameterized routes.
  • Prepared Pattern Matching: Built-in prepared matchers for common route constraints such as UUIDs, digits, slugs, dates, hex values, base64 values, and safe path segments.
  • Regex Route Parameters: Define custom route parameters with regular expressions and validation.
  • Route Groups: Organize routes using hierarchical groups with inherited middleware.
  • Middleware Pipeline: Compose global, grouped, and route-level middleware.
  • Mount Support: Mount existing http.Handler and http.HandlerFunc implementations under route prefixes.
  • Pooled Request Context: Per-request context with parameter access and temporary key/value storage backed by sync.Pool.
  • Health check Endpoints: Built-in liveness and readiness route helpers.
  • Rate Limiting Guard: Built-in middleware for request throttling and cooldown-based protection.
  • Built-in pprof Profiling: Enable a dedicated profiling server with Go’s standard net/http/pprof.
  • Static File Serving: Serve static directories with automatic favicon.ico support.
  • Custom NotFound Handler: Override the default 404 page not found response.
  • Custom Recovery Handler: Recover from panics and provide your own fallback response.
  • Panic Logging: Panic details are logged through Go’s standard log/slog, including request method and path.
  • Access Logging: Optional middleware for structured request logging.
  • Multi-Server Support: Run multiple listeners from a single router, useful for services exposing multiple ports.
  • Graceful Shutdown: Handles interrupt and termination signals with safe HTTP server shutdown.
  • Efficient Method Matching: Uses HTTP method bitmasks for fast method validation and 405 Method Not Allowed handling.
  • Standard Library Compatible: Works with net/http, http.Handler, http.HandlerFunc, and log/slog.

Requirements

This package requires Go 1.25 or newer.

It is designed for modern Go projects and may use language and standard library features introduced in recent Go versions.

  • Go: 1.25 or newer
  • Dependencies: Standard library + github.com/netlifeguru/logger
  • Features used: Generics, concurrency primitives

The package is optimized for concurrent workloads and low allocation overhead, making it suitable for APIs, internal services, edge gateways, backend platforms, and modern distributed systems.

Examples

Practical examples are available in the official examples repository

Installation

Install the router package into your Go project.

On this page

NLG HTTP RouterFeaturesRequirements