Skip to content
zig 0.17 · v0.5.4 · latest

Build microservices
in Zig.
One binary. No GC.

Zero is a batteries-included web framework for Zig. Wire REST, SQL, NoSQL, cache, pub/sub, auth, GraphQL and observability into a single static binary, configured almost entirely through .env.

runs in ~15 lines ↗
~/my-app — zero
installzig fetch --save https://github.com/im-ng/zero/archive/refs/heads/main.zip
  • 0requests / sec
  • 0typical RSS (16–50)
  • 0lines to first API
  • 0integrations built-in
why zero

The microservice building blocks,
wired for you.

Zero boilerplate

Databases, queues, auth and observability plug in with no glue code. Everything is wired through .env.

no glue code, really

Single static binary

Compile to one dependency-free binary. Tiny RSS (~16–65 MiB), no managed runtime, ships anywhere, including Kubernetes.

ships anywhere ↘

Observable by default

Structured JSON logs, Prometheus metrics, distributed tracing and health endpoints are wired in from the first request.

from req #1

Fast and small

Tens of thousands of requests/sec at ~50 MiB RSS. No GC pauses, no JIT warm-up, explicit memory control.

no GC pauses!
try the config

Flip a switch.

Everything on the right is driven by the config on the left — the same .env that drives a real zero app. Handlers come from your code; config decides which backends they can reach.

configs/.env
APP_NAME=
APP_ENV=dev
HTTP_PORT=
LOG_LEVEL=
# batteries — opt in via config
SQLITE_PATH=data.db
REDIS_HOST=localhost:6379
AUTH_MODE=Basic
PUBSUB_BACKEND=NATS
2 of 4 batteries in use
~/my-app — zeroboot 108ms
routes — src/main.zig
GET/jsonGET/api/usersGET/cache/:keyPOST/events

registered in code — config connects their backends

localhost:8080/json
hello, json

That's the whole app.

  • Drop it in src/main.zig
  • Add a configs/.env
  • zig build run gives you a JSON API with structured logs
  • /metrics already live.

Everything else (Postgres, Redis, Kafka, auth, GraphQL and metrics) is opt-in through configuration. Nothing to wire by hand.

Full walkthrough
~15 lines → running API
src/main.zig
const std = @import("std");
const zero = @import("zero");
const App = zero.App;

pub const std_options: std.Options = .{ .logFn = zero.logger.custom };

pub fn main(init: std.process.Init) !void {
    var arena = std.heap.ArenaAllocator.init(std.heap.page_allocator);
    defer arena.deinit();

    const app = try App.new(arena.allocator(), init.io, init.environ_map);
    try app.get("/json", jsonResponse);
    try app.run();
}

fn jsonResponse(ctx: *zero.Context) !void {
    try ctx.json(.{ .msg = "hello zero!" });
}
one feature, many shapes

Same endpoint, your way.

Zero keeps the surface small. Write the endpoint as a handler, boot it with a few lines of config, and call it with a single curl — no framework magic in between.

  • Handler — full control in Zig
  • Config — boots the app; batteries are opt-in
  • Client — it's just HTTP
src/main.zig
try it live

Feel the rate limiter.

Zero's limiter is a fixed window, on by default — no handler code. This mirrors it: hit RATE_LIMIT_MAX and every extra request gets 429 until the window resets.

5 max / window10s window429 + Retry-After
configs/.env
# on by default — no handler code to enable
RATE_LIMIT_ENABLE=true
RATE_LIMIT_MAX=5          # requests per window (default 100)
RATE_LIMIT_WINDOW=10       # window, seconds (default 60)
RATE_LIMIT_KEY=ip          # or header:X-Forwarded-For

# over max? -> 429 Too Many Requests + Retry-After
ALLOWED5 left this window
requests left5 / 5
window10s left

fixed window — resets every 10s, and Retry-After counts down with it

  • #resultat
  • no requests yet — press Send
the constellation

30+ integrations, one App.new.

Every piece is opt-in through configuration. Hover or focus a node to see what it does.

Web & APIData storesMessagingCross-cuttingREST / CRUDAutoCRUDGraphQLProtobufWebSocketSwagger UIPostgreSQLSQLiteDuckDBRedisCassandraInfluxDBSolrS3 / FileKafkaNATSMQTTPub/SubAuthCORSMetricsTracingHealthLoggingMigrationsCronCLIRate LimiterResilienceHTTP Clientzero.
integrationPick a node

Hover or focus any node in the map to reveal what Zero wires in for you.

the difference

One binary. Nothing else to ship.

Drag the divider to compare a Zero service with a typical Go / Node setup.

Typical Go / Node
  • Outputruntime + deps
  • Memory (RSS)200–500+ MiB
  • Boilerplatescaffolding + DI
  • GC / JITyes
  • Deployruntime + PM
Zero zig 0.17
  • Output1 static binary
  • Memory (RSS)~50 MiB
  • Boilerplate~15 lines
  • GC / JITnone
  • Deploycopy & run

← drag →

observability & benchmarks

Numbers you can reproduce.

The bundled benchmark harness drives a concurrency ramp and reports throughput, latency percentiles and per-level RSS. CI runs it for regression.

  • 0requests / secsingle binary
  • 0p99 latencyunder load
  • 0RSS at speed16–50 MiB range
  • 0framework testswith coverage
head-to-head
Zero
10,300
Typical Go
3,100
Typical Node
1,200
See the methodology →
ready when you are

Start building in Zig.

One dependency-free binary. No GC. Everything else is configuration.

zig fetch --save https://github.com/im-ng/zero/archive/refs/heads/main.zip