Neutron Zig
Embedded SDK for systems that measure binary size in kilobytes. Zero heap allocations on the hot path, comptime SQL validation, all 14 Nucleus data models — in 12 KB.
Twelve kilobytes. Zero heap. All of Nucleus.
Small enough to ship in firmware.
Most database clients assume you have a megabyte of RAM and a garbage collector. Neutron Zig assumes neither. The whole SDK — HAL, wire protocol, all 14 Nucleus model clients, JWT, compression, SSE — compiles to a 12 KB release binary with zero heap allocations on the hot path. It runs on your server, on your Raspberry Pi Pico, and on your mechanical keyboard.
const std = @import("std");
const neutron = @import("neutron");
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
var db = try neutron.connect(gpa.allocator(), .{
.url = "postgres://localhost/app",
});
defer db.deinit();
// SQL is validated at comptime. This fails to compile if the
// schema changes and the columns don't match.
const rows = try db.sql(
"SELECT id, title FROM articles WHERE views > $1",
.{1000},
struct { id: i64, title: []const u8 },
);
defer rows.deinit();
for (rows.items) |row| {
std.debug.print("{d}: {s}\n", .{ row.id, row.title });
}
}test blocks live next to the code they exercise. Run zig build test and the whole SDK verifies in seconds.Binary size, at rest.
ReleaseSmall with link-time optimization, stripped. Measured on x86_64-linux. Same ballpark on aarch64, wasm32, and RISC-V.
What it's for
Firmware that needs to write telemetry straight into Nucleus. Edge devices where every kilobyte matters. CLI tools that want a real database client without shipping a JVM. WASM modules running in a serverless edge. Anything where you'd reach for C but would rather have Zig's safety and comptime.
Why Zig?
Because comptime replaces macros, codegen, and half the reasons you reach for C++. Because the allocator-by-reference convention makes memory explicit instead of implicit. Because there's no hidden control flow — if it allocates, you wrote the allocator. For a database client that has to be small and predictable, it's the right tool.
Part of a bigger system
Stream telemetry from a Zig edge device into the Nucleus streams model. Serve dashboards from Neutron TypeScript. Train models in Neutron Mojo. Orchestrate in Go. Same contract, same database, same source of truth — from a microcontroller to a cluster.