zerohttpcontrib

package module
v0.0.0-...-5d571a5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 0 Imported by: 0

README

zerohttp-contrib Go Reference Go Report Card Coverage Status

Optional adapters and extensions for zerohttp. Each module is standalone - import only what you need.

Installation

go get github.com/alexferl/zerohttp-contrib/<category>/<name>

Adapters

Adapter Description Example
adapters/huma OpenAPI 3.1 via Huma examples/adapters/huma
adapters/zerolog Structured logging via zerolog examples/adapters/zerolog

Extensions

Extension Description Example
extensions/autocert Automatic TLS via Let's Encrypt examples/extensions/autocert
extensions/http3 HTTP/3 support via quic-go/quic-go examples/extensions/http3
extensions/webtransport WebTransport support via quic-go/webtransport-go examples/extensions/webtransport
extensions/websocket WebSocket support via gorilla/websocket examples/extensions/websocket

Middleware

Middleware Description Example
middleware/cache Redis store for response caching examples/middleware/cache
middleware/compress Brotli/Zstd compression examples/middleware/compress
middleware/idempotency Redis store for idempotency examples/middleware/idempotency
middleware/jwtauth JWT support via lestrrat-go/jwx examples/middleware/jwtauth
middleware/ratelimit Redis store for distributed limits examples/middleware/ratelimit
middleware/tracer OpenTelemetry tracer adapter examples/middleware/tracer

Storage

Storage Description
storage Redis adapter implementing zerohttp/storage.Storage

Structure

adapters/       # Interface adapters (logging, OpenAPI, etc.)
extensions/     # Protocol extensions (HTTP/3, WebTransport, etc.)
middleware/     # Pluggable middleware adapters
storage/        # Storage adapters (Redis, etc.)

Each subdirectory is an independent Go module with its own go.mod.

Reference Implementations

The modules in this repository demonstrate how to integrate specific third-party libraries with zerohttp.

If you need to use a different library (e.g., zap instead of zerolog, or a different Redis client), create your own module. Copy the adapter code from this repo, modify it for your library, and maintain it in your own project or as a separate module.

The zerohttp core is intentionally minimal with zero dependencies. This contrib repo provides examples - you are encouraged to build and maintain your own adapters for your specific needs.

License

MIT License - see LICENSE for details.

Documentation

Overview

Package zerohttpcontrib provides optional adapters and extensions for zerohttp.

This module contains integrations that extend zerohttp's core functionality while maintaining its zero-dependency philosophy. Each subdirectory is a standalone module that can be imported independently.

Structure

adapters/       # Interface adapters (logging, OpenAPI, etc.)
extensions/     # Protocol extensions (HTTP/3, WebTransport, etc.)
middleware/     # Pluggable middleware adapters

Adapters

  • adapters/huma - OpenAPI 3.1 via Huma
  • adapters/zerolog - Structured logging via zerolog

Extensions

  • extensions/autocert - Automatic TLS via Let's Encrypt
  • extensions/http3 - HTTP/3 support via quic-go
  • extensions/webtransport - WebTransport support
  • extensions/websocket - WebSocket support via gorilla/websocket

Middleware

  • middleware/cache - Redis store for response caching
  • middleware/compress - Brotli/Zstd compression
  • middleware/idempotency - Redis store for idempotency
  • middleware/jwtauth - JWT support via lestrrat-go/jwx
  • middleware/ratelimit - Redis store for distributed rate limiting
  • middleware/tracer - OpenTelemetry tracer adapter

Installation

Import only the modules you need:

go get github.com/alexferl/zerohttp-contrib/adapters/zerolog
go get github.com/alexferl/zerohttp-contrib/middleware/tracer

The modules in this repository demonstrate how to integrate specific third-party libraries with zerohttp. You are encouraged to use these as reference implementations and create your own adapters for your specific needs.

See https://github.com/alexferl/zerohttp for the core library.

Directories

Path Synopsis
adapters
huma module
zerolog module
extensions
autocert module
http3 module
middleware
compress module
jwtauth module
ratelimit module
tracer module
storage module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL