Skip to content

Zinc

v0.3.0MITGo 1.25+

Galvanize net/http.

The high-performance, minimalist web layer for Go. Routing, binding, errors, and 29 middleware, applied as a thin coat over the standard library you already trust.

RouterEdit the path, or pick an example
  1. /usersstatic
  2. /42{id}
  3. /postsstatic
  4. /7{post}
  1. /
  2. healthhealth
  3. users
  4. mecurrentUser
  5. {id} = "42"showUser
  6. posts
  7. {post} = "7"showPost
  8. files
  9. {path...}serveFile
app.Get("/users/{id}/posts/{post}", showPost)c.Param("id")   // "42"c.Param("post") // "7"// Literals compare without case; captured values keep theirs.

What you get

Everything a service needs. Nothing it doesn't.

Follow one request through Zinc, from the first middleware to the response.

app.Use(
    middleware.RequestID(),
    middleware.RequestLogger(),
    middleware.Recover(),
    middleware.Secure(),
)

api := app.Group("/api", middleware.ContextTimeout(5*time.Second))

L2Every response carries an ID that your logs share.Guide →

GET /api/users/42

200 OK

X-Request-Id: 9f2c4e1a7b3d5c8e0a6f1b2c3d4e5f60

X-Content-Type-Options: nosniff

X-Frame-Options: SAMEORIGIN

How it fits

A thin coat, not a new engine.

Galvanizing protects steel without replacing it. Zinc does the same for net/http: your app is still an http.Handler, and standard handlers, middleware, and servers plug straight in.

Pick one to see where it plugs into the stack.

Zinc and net/http →
Section A–Arequest ↑ · response ↓
Your applicationhandlers · services · packages
listUserscreateUserpromhttp.Handler()

zinc.HandlerFunchttp.Handler

Zincrouting · binding · errors · middleware
Standard middlewareotelhttp · func(http.Handler) http.Handler
net/httpthe standard library, untouched
http.Server{Handler: app}*http.Requesthttp.ResponseWriter
http.Handler inhttp.Handler out

Measured, in the repo

60/ 77

Scenarios where Zinc recorded the lowest latency against Gin, Echo, and Chi. Gin led 12, Chi 3, and Echo 2. Zinc was measured on 25 September; rival samples are from 24 September.

Zinc fastestA rival fastest

Mixed-date comparison25 September 2026Apple M1 Pro · go1.27.1 · commit 42e11d2

Full benchmark report →

HelloWorldns/op · lower is faster

  1. Zinc86.75fastest
  2. Gin136.91.58×
  3. Echo152.91.76×
  4. Chi180.82.08×

Middleware

A periodic table of production parts.

Numbered in chain order: each part wraps everything after it. Select parts to galvanize them into a stack, and the table writes the app.Use call in the right order.

Start from
Observe1–6Sees every request, so it wraps the rest
  1. ↗
  2. ↗
  3. ↗
  4. ↗
  5. ↗
  6. ↗
Contain7–11Bounds panics, time, size, and load
  1. ↗
  2. ↗
  3. ↗
  4. ↗
  5. ↗
Shape12–15Normalises the URL before routing
  1. ↗
  2. ↗
  3. ↗
  4. ↗
Guard16–24Decides who gets in
  1. ↗
  2. ↗
  3. ↗
  4. ↗
  5. ↗
  6. ↗
  7. ↗
  8. ↗
  9. ↗
Carry25–29Encodes and serves the response
  1. ↗
  2. ↗
  3. ↗
  4. ↗
  5. ↗

Your compound

RiLgRcSh

4 parts, outermost first

main.go
app.Use(
	middleware.RequestID(),
	middleware.RequestLogger(),
	middleware.Recover(),
	middleware.Secure(),
)

Coat your first service.

Start a new API in a few minutes, or add Zinc to a service you already run.