Mizu is a lightweight web framework for Go. The name means “water” in Japanese, reflecting the framework’s goal: to flow naturally with Go’s standard library rather than replacing it.
What is Mizu?
Mizu helps you build web servers and APIs in Go. If you’ve used Python’s Flask, Node’s Express, or Ruby’s Sinatra, Mizu fills a similar role but stays closer to how Go works. A web framework handles the repetitive parts of building HTTP servers:- Routing: Matching URLs like
/users/123to your code - Request handling: Reading data from forms, JSON bodies, and URLs
- Response writing: Sending back JSON, HTML, or files
- Middleware: Running shared code (logging, auth) before handlers
What makes Mizu different?
Mizu adds a thin layer over Go’snet/http package instead of replacing it:
| Feature | What it does | Why it matters |
|---|---|---|
| Go 1.22 ServeMux patterns | Routes like /users/{id} with path parameters | Uses the standard library, not a custom router |
| Context wrapper | c.JSON(), c.Query(), c.Param() helpers | Less boilerplate, cleaner handlers |
| Error returns | Handlers return errors directly | Central error handling, simpler code |
| Graceful shutdown | Finishes active requests before stopping | Safe deployments without dropped connections |
| Structured logging | Uses Go’s slog package | JSON logs for production, readable logs for development |
net/http, you already understand how Mizu works.
Who is Mizu for?
Mizu is a good fit if you:- Know Go basics and want to build web APIs
- Prefer explicit code over “magic” conventions
- Want to use standard library patterns, not framework-specific ones
- Need a small, focused tool rather than a full-stack framework
A quick taste
Here’s a complete Mizu server in 15 lines:- Visiting
http://localhost:3000/returns “Hello, Mizu!” as plain text - Visiting
http://localhost:3000/users/42returns{"user_id":"42"}as JSON - Pressing Ctrl+C stops the server gracefully