A Zig Web Skeleton That Ships with MySQL, Auth, and OpenAPI — and Hits 60K RPS on an M1
A 10× throughput gap over a mainstream framework on the same hardware changes the cost calculus for high-throughput services. The skeleton also demonstrates that Zig’s comptime can replace entire categories of runtime machinery — DI containers, reflection-based doc generators, and dynamic middleware ordering — with compile-time checks that fail fast.
wing-app bundles zio, talon, wing, and mantle into a layered backend template that handles routing, typed request extraction, database connection pooling, migrations, and server-side sessions. Dependencies are assembled explicitly in AppState and projected into handlers by type at compile time — no runtime DI container. The project also generates OpenAPI 3.1 specs directly from handler signatures and serves an interactive Scalar doc page.
A quick benchmark on an Apple M1 shows the skeleton pushing over 60,000 requests per second, roughly 10× the throughput of a comparable .NET Minimal API running on the same machine. The codebase is still pre-release and depends on sibling-directory builds of wing and mantle, but the architecture is production-shaped: config via environment variables, cookie security attributes set, and error-to-status-code mapping centralized in one file.
Zig’s comptime lets a web framework absorb work that other ecosystems hand to runtime reflection — DI assembly, OpenAPI schema generation, and middleware ordering checks all happen before the binary runs.
Explicit dependency projection by type is a pragmatic middle ground: it avoids both manual wiring boilerplate and the opaque magic of runtime containers, at the cost of requiring distinct wrapper types when two dependencies share a type.
Deriving API docs from handler signatures treats code as the single source of truth, which directly attacks the doc-rot problem that plagues projects where specs are maintained separately.
The 10× throughput delta isn’t just a language benchmark — it suggests that for I/O-bound services, Zig’s lack of a heavy runtime and its async model can translate into real hosting-cost differences.
Shipping with real MySQL, migrations, and session management signals that the Zig web ecosystem is moving past ‘can it serve HTTP?’ toward ‘can it run a production service?’ — even if the dependency story hasn’t stabilized yet.