Zigly

January 20, 2026 · View on GitHub

Zigly is a Zig library for building Fastly Compute services. It provides high-level bindings for Fastly's edge computing platform, targeting WebAssembly.

Why Zig?

Fastly Compute bills based on execution time and memory usage. The Zig compiler produces WebAssembly modules that are exceptionally small, fast, and memory-efficient—often significantly smaller than equivalent Rust code, and orders of magnitude smaller than JavaScript bundles.

This translates directly to lower costs: smaller binaries mean faster cold starts, less memory overhead, and reduced execution time.

Quick Example

const zigly = @import("zigly");

pub fn main() !void {
    var downstream = try zigly.downstream();

    // Option 1: Proxy to a backend
    try downstream.proxy("origin", "api.example.com");

    // Option 2: Build a custom response
    // try downstream.response.setStatus(200);
    // try downstream.response.body.writeAll("Hello from the edge!");
    // try downstream.response.finish();
}

Features

  • HTTP handling - Full request/response manipulation with headers and bodies
  • Caching - Simple and transactional cache APIs with TTL and stale-while-revalidate
  • Rate limiting - Edge rate limiting with rate counters and penalty boxes
  • Geolocation - IP-based location lookup
  • Device detection - Identify mobile, tablet, and desktop devices
  • Backends - Static and dynamic backend management with SSL support
  • KV store - Key-value storage at the edge
  • ACLs - IP-based access control lists
  • Logging - Send logs to external endpoints
  • Purging - Invalidate cached content by surrogate key

Documentation

Getting Started

  1. Installation - Add Zigly to your project
  2. Hello World - Build your first edge service
  3. Testing Locally - Run services locally
  4. Deployment - Deploy to Fastly Compute

Concepts

Guides

API Reference

Examples

Requirements

License

See the repository for license information.