Skip to content

Getting Started

httpx.zig is a modern, feature-rich HTTP library for the Zig programming language. It is designed to be production-ready, supporting robust client and server implementations with focus on performance and developer experience.

Features

  • Protocol Support: Production-ready HTTP/1.0/1.1/2/3 client/server runtime paths plus full HTTP/2 and HTTP/3 protocol primitives.
  • Cross-Platform: Validated on Linux, Windows, and macOS with x86_64, aarch64, and x86 architectures.
  • Client:
    • Connection pooling and keep-alive.
    • Automatic retries with exponential backoff.
    • Request/Response interceptors.
    • Cookie management.
  • Server:
    • Pattern-based routing.
    • Middleware architecture.
    • Static file serving.
    • JSON helpers.
  • Concurrency: Built-in thread pool and async primitives (all, any, race).
  • Security: TLS/SSL support (via std.crypto or system libraries) with custom CA handling.
  • Explicit Root Helpers: Top-level aliases for requests (fetch/send/...), concurrency (first/fastest/settled), and networking (resolveAddress, parseAndResolveAddress, netInit/netDeinit).

Custom HTTP/2 & HTTP/3 Implementation

Zig's standard library does not provide HTTP/2, HTTP/3, or QUIC support. httpx.zig implements these protocols entirely from scratch, including HPACK (RFC 7541), QPACK (RFC 9204), HTTP/2 framing (RFC 7540), and QUIC transport (RFC 9000).

Requirements

  • Zig Version: 0.15.0 or later (tested on 0.15.2)
  • Operating System: Windows, Linux, or macOS

Platform Support

Operating Systems

PlatformStatusNotes
Linux✅ FullAll major distributions (Ubuntu, Debian, Fedora, Arch, etc.)
Windows✅ FullWindows 10/11, Server 2019+
macOS✅ FullmacOS 11+ (Big Sur and later)

Architectures

ArchitectureLinuxWindowsmacOSNotes
x86_64 (64-bit)Primary development target
aarch64 (ARM64)Apple Silicon, AWS Graviton, Raspberry Pi 4+
x86 (32-bit)Legacy x86 support on Linux/Windows

Cross-Compilation

Zig's built-in cross-compilation makes it easy to build for any target:

bash
# Build for Linux x86_64
zig build -Dtarget=x86_64-linux

# Build for Linux ARM64
zig build -Dtarget=aarch64-linux

# Build for Windows x86_64
zig build -Dtarget=x86_64-windows

# Build for Windows x86 (32-bit)
zig build -Dtarget=x86-windows

# Build for macOS ARM64 (Apple Silicon)
zig build -Dtarget=aarch64-macos

# Build for macOS x86_64 (Intel)
zig build -Dtarget=x86_64-macos

Next Steps

Released under the MIT License.