Getting started#
Zyn is an agent-first application framework for websites and APIs written in Zig.
Install#
Zyn requires Zig 0.16.0. The release installer supports Linux x86-64 and AArch64, and macOS 13+ on Intel and Apple Silicon. No account or download token is required.
curl -fsSL https://zigonzyn.org/install.sh | sh
The installer adds Zyn to your shell's PATH. Open a new terminal after installing. Use zyn upgrade for subsequent updates; see Upgrade.
For a source checkout, run zig build and place zig-out/bin/zyn on PATH.
Create a project#
Bundled local PostgreSQL supports x86_64 and AArch64 macOS and Linux, plus x86_64 Windows. The first zyn init that downloads PostgreSQL requires network access, curl, and tar.
In an empty project directory, run:
zyn init
zyn dev
zyn init prompts for the project name. For non-interactive setup, use zyn init --name my-app.
When Caddy 2 is available, open https://localhost:7532. Otherwise zyn reports its HTTP fallback at http://localhost:7532. Use PORT to choose another public port, zyn dev --http to force HTTP, or zyn dev --https to require Caddy.
Add an endpoint#
To add a JSON endpoint, add this entry to table in src/routes.zig:
.get("/hello/:name", hello, &.{}),
Then add its action in the same file:
fn hello(action: *zyn.Action) !zyn.Response {
return action.json(.{ .hello = action.param("name") }, .{});
}
zyn routes will then include GET /hello/:name.
Next steps#
Run zyn check to validate the application and zyn context for its source map. See Add a JSON endpoint for endpoint tests and Actions for request and response APIs. The generated ZYN.md guides coding agents through application changes.
Before deploying with zyn deploy, read Deployment for host requirements and migration safety.