Capability networking and durable state in Zig
glowcap
Share objects between programs, with access that can be passed on or narrowed. glowcap carries the calls across the network, and Loam keeps object state across restarts.
Alpha · Apache-2.0
Try it
Rooms is a chat app built on glowcap. Its browser app uses a server on your machine to list rooms and hand out nicknames. Install and start the server with:
curl -fsSL https://glowcap.org/install.sh | sh
export PATH="$HOME/.local/bin:$PATH"
glowcap apps rooms serve
Open the printed link. It includes your server’s address, and your session stays in your browser. Pick a member in a room and press Message name directly to talk without the room in the middle. Run Rooms covers joining and direct messages. The CapTP CLI calls and hosts capabilities from your shell, with a REPL and MCP tools.
The install script verifies the archive against the release checksum before running the installer inside the archive. GitHub Releases lists the downloads and their provenance.
What glowcap is
glowcap implements OCapN and CapTP in Zig. Loam provides transactional storage and durable actors. Your application controls memory, I/O, and scheduling.
Why OCapN compares capabilities with bearer tokens and login tables. What about identity? covers how access, identity, and responsibility differ for people and agents.
APIs, ABIs, and storage formats can change before 1.0. Read Project & status before depending on it.
Build with it
A Zig program dials a peer over encrypted TCP, fetches a capability it published, and calls it. The caller supplies io, allocator, the server’s public key, and its socket address:
var hint_storage: [1]glowcap.ocapn.model.HintEntry = undefined;
const peer_key = "<64 lowercase hex characters from the server>";
const partner = glowcap.net.tcp.noise.locator(
peer_key,
"127.0.0.1:9099",
&hint_storage,
);
const session = try glowcap.driver.connect(
allocator,
io,
.{ .symbols = &.{.noise_tcp} },
partner,
.ephemeral,
.{ .handshake = .{ .ms = 10_000 }, .settle = .{ .ms = 10_000 } },
);
defer session.deinit();
const greeter = try session.fetch("greeter"); // a capability this peer published
var arena = std.heap.ArenaAllocator.init(allocator);
defer arena.deinit();
const settled = try session.call(greeter, "greet", &.{.{ .string = "world" }}, arena.allocator());
switch (settled) {
.fulfilled => |value| std.debug.print("{s}\n", .{value.string}),
.broken => |reason| std.debug.print("the greeter refused: {f}\n", .{reason}),
}
Start building shows the listening side and the same call in other languages. Use glowcap as a Zig package, a C ABI, or a binding for Rust, TypeScript, Python, or Racket. The TypeScript binding also runs in the browser over WebAssembly. Choose an API compares the entry points.
The protocol core is a synchronous state machine with no I/O of its own, so sockets, threads, and scheduling stay in your program. Peers can connect over iroh, Noise, WebRTC, or Tor, among other paths. Choosing a transport compares reachability, encryption, and identity.
Performance reports measured costs and checked allocation and copy budgets. What you can depend on explains which behavior is tested and where outside testing is still needed.
AI coding assistants help write glowcap. The maintainer directs the work and is answerable for what lands. How glowcap is built records the process.