Skip to content
The Anole logo, a green lizard on an orange square

Anole

Anole aims to make building a backend in Zig as easy as in Express, Fiber or Bun. One library for the whole backend, with sane defaults and one-line setup, so a solo developer can launch an app without assembling a stack first.
src/main.zig
const std = @import("std");
const anole = @import("anole");
fn hello(_: *anole.Request, res: *anole.Response) !void {
res.body = "Hello, World!";
}
pub fn main(init: std.process.Init) !void {
var app = try anole.App.init(init.gpa, .{});
defer app.deinit();
app.get("/", hello);
try app.listen(":3000"); // HTTP/1.1 and HTTP/2; Ctrl-C drains and stops
}

Add Anole with zig fetch --save, make build.zig one addApp call, then zig build run. Zig compiles every C library Anole uses, so there is nothing else to install. Getting started walks through it, then on to a JSON API, WebSockets, TLS, gRPC and deploying.

HTTP/1.1, HTTP/2 and HTTP/3

One router and one handler signature for every protocol. HTTP/2 on nghttp2 (TLS and cleartext), HTTP/3 on ngtcp2 and nghttp3, with graceful drain and zero-downtime restarts.

WebSocket and WebTransport

WebSocket over HTTP/1.1, HTTP/2 and HTTP/3 with one Socket type. WebTransport sessions over HTTP/3, with streams and datagrams.

gRPC

Services generated from .proto files, on the same router as REST. Also answers gRPC-Web, Connect and JSON transcoding (google.api.http). protoc is fetched by the build.

TLS on BoringSSL

Bundled and compiled by Zig: ALPN, mutual TLS, hot certificate reload, and the same TLS stack for the server and every client.

Auth

JWT with JWKS, OIDC sign-in, sessions, CSRF tokens, API keys, roles and rate limits, as middleware you put on the routes that need it.

Databases

PostgreSQL, SQLite, MongoDB and Redis behind one shape: rows as your structs, request deadlines, pools per core, and opt-in request coalescing and result caching.

Observability

Request IDs, access logs, Prometheus metrics, OpenTelemetry tracing and health checks, one line each.

Only what you use

Every bundled library sits behind a build flag. Turn a feature off and it is never downloaded or compiled into your binary.