H(TTP) server framework built for high performance and safety running on Zig. Zero dependencies, memory safe, and blazingly fast.
const std = @import("std");
const h3 = @import("h3");
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
var app = try h3.createApp(gpa.allocator());
defer app.deinit();
_ = app.get("/", homeHandler);
_ = app.get("/api/users/:id", getUserHandler);
try h3.serve(&app, .{ .port = 3000 });
}
fn homeHandler(event: *h3.Event) !void {
try h3.sendJson(event, .{
.message = "Hello from h3z!",
.framework = "h3z",
.language = "Zig"
});
}
fn getUserHandler(event: *h3.Event) !void {
const id = h3.getParam(event, "id") orelse "unknown";
try h3.sendJson(event, .{
.id = id,
.name = "Zig Developer",
.framework = "h3z"
});
}
Built with Zig's philosophy of optimal performance and safety
Built with Zig for maximum performance. Zero-cost abstractions and compile-time optimizations.
Zig's compile-time memory safety guarantees. No undefined behavior, no memory leaks.
Pure Zig implementation with no external dependencies. Minimal attack surface and easy deployment.
Modular architecture with middleware support. Build exactly what you need, nothing more.
Compile-time type checking and safety. Catch errors before they reach production.
Runs on Linux, macOS, Windows, and more. One codebase, everywhere Zig runs.
Create your first h3z application with just a few commands
curl -sSL https://ziglang.org/download/ | sh
zig init
// Add to build.zig.zon
.dependencies = .{
.h3 = .{
.url = "https://github.com/dg0230/h3z/archive/main.tar.gz",
.hash = "12345..." // zig will provide this
}
}
zig build run