Craft uses Pantry to provide the current stable Zig toolchain:
pantry installeval "$(pantry env)" && zig version
# Should show Pantry's installed stable Zig versionBuild from the repository root:
bun run build:coreRun tests:
bun run testRun the example app:
bun run runCreate a new file my-app.zig:
const std = @import("std");
const craft = @import("craft");
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
const allocator = gpa.allocator();
var app = craft.App.init(allocator);
defer app.deinit();
const html =
\\<!DOCTYPE html>
\\<html>
\\<head>
\\ <title>My First Craft App</title>
\\ <style>
\\ body {
\\ font-family: system-ui;
\\ display: flex;
\\ justify-content: center;
\\ align-items: center;
\\ height: 100vh;
\\ margin: 0;
\\ background: #f0f0f0;
\\ }
\\ h1 { color: #333; }
\\ </style>
\\</head>
\\<body>
\\ <h1>Hello, Craft!</h1>
\\</body>
\\</html>
;
_ = try app.createWindow("My First App", 800, 600, html);
try app.run();
}Create a build.zig file:
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const craft_module = b.dependency("craft", .{
.target = target,
.optimize = optimize,
}).module("craft");
const exe = b.addExecutable(.{
.name = "my-app",
.root_source_file = b.path("my-app.zig"),
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("craft", craft_module);
b.installArtifact(exe);
const run_cmd = b.addRunArtifact(exe);
const run_step = b.step("run", "Run the app");
run_step.dependOn(&run_cmd.step);
}Then build and run:
zig build runOn macOS, Craft uses WebKit framework which is included by default. No additional dependencies needed.
Install required dependencies:
Ubuntu/Debian:
sudo apt-get install libgtk-3-dev libwebkit2gtk-4.1-devFedora:
sudo dnf install gtk3-devel webkit2gtk3-develArch:
sudo pacman -S gtk3 webkit2gtkOn Windows, you need WebView2 Runtime:
- Download from Microsoft Edge WebView2
- Install the Evergreen Runtime
A typical Craft project:
my-craft-app/
├── build.zig # Build configuration
├── src/
│ └── main.zig # Your app code
├── assets/ # Static files (optional)
│ ├── index.html
│ ├── style.css
│ └── app.js
└── zig-out/ # Build output (generated)
- Check out the examples
- Read the API documentation
- Join the Stacks community
Make sure Zig is installed and in your PATH. Try:
which zig # macOS/Linux
where zig # WindowsMake sure you have the required development libraries:
# Ubuntu/Debian
sudo apt-get install build-essential libgtk-3-dev libwebkit2gtk-4.1-devInstall WebView2 Runtime from Microsoft's website.
- ✅ Has a clean, working API
- ✅ Compiles successfully
- ✅ Passes tests
- 🚧 Needs platform-specific webview bindings (in progress)
You can use Craft today to design your app structure and UI, and full webview rendering will be available as platform bindings are completed.