Skip to main content
Mizu provides a focused set of features for building web applications in Go. Each feature is designed to feel familiar if you already know Go’s standard library.

Routing

Routing connects URLs to handler functions. Mizu uses Go 1.22’s enhanced ServeMux which supports path parameters natively.
Key features:
  • Path parameters using {param} syntax (Go 1.22 ServeMux patterns)
  • HTTP method helpers: Get, Post, Put, Patch, Delete, Head, Connect, Trace
  • Route groups with Group() and Prefix() for organizing related endpoints
  • Scoped middleware with With() to apply middleware to specific routes
  • Mount http.Handler with Mount() for interoperability with standard handlers

Request handling

Reading data from requests is explicit and straightforward. Each method does one thing clearly.

Response helpers

Response methods write data with appropriate headers and status codes.

Middleware

Middleware wraps handlers to add behavior before or after request processing. The pattern is simple: take a handler, return a handler.
Applying middleware:
Writing middleware:

Logging

Mizu includes a request logger that uses Go’s slog package for structured logging.
Log modes:
  • mizu.Auto - Colored text for terminals, JSON for non-terminals (default)
  • mizu.Dev - Human-readable text format
  • mizu.Prod - JSON lines for log collectors

Error handling

Handlers return errors directly. Mizu catches returned errors and recovered panics in one central place.

Server lifecycle

Mizu handles graceful shutdown automatically. When your server receives SIGINT (Ctrl+C) or SIGTERM, it:
  1. Stops accepting new connections
  2. Waits for active requests to complete (up to timeout)
  3. Shuts down cleanly
Health check endpoints for load balancers and Kubernetes:

Static files

Serve files from disk or embedded filesystems.

Summary

Mizu stays small and predictable. Everything is plain Go code with no hidden behavior.