English | 日本語
A toolkit for building native desktop UIs in Rust. Views are declarative markup in .native files. Logic is a Model / Msg / update loop. The engine draws every pixel itself.
No browser. No WebView. No JavaScript runtime in the binary.
Inspired by Vercel Labs' Native SDK (Zig). nativum is an independent original implementation — not affiliated with Vercel, and not a port of that source tree. See NOTICE.
Native SDK's bet is the one worth copying: keep the expressive authoring model, replace the heavy runtime. Markup + a pure update function is a shape humans and agents can both write. A software renderer is a shape tests can pin.
Where Native compiles TypeScript cores to Zig, nativum is Rust. App cores are either a tiny JSON TEA file (src/core.json) so a directory is enough, or a Rust Session embedding the same engine.
cargo install --path crates/nativum-cli
nativum init my_app
cd my_app
nativum check
nativum run # real OS window — click and type
nativum render --out preview.png
nativum test
nativum preview # http://127.0.0.1:8787 — click the framenativum run opens a desktop window and presents the software-rendered frames through the OS (winit + softbuffer). Same pixels, same update loop. preview is the HTTP shell around that PNG for environments without a display.
The scaffolded counter is three files of truth:
<!-- src/app.native -->
<row gap="8" main="center">
<button variant="secondary" on-press="decrement">-</button>
<text>{count}</text>
<button variant="primary" on-press="increment">+</button>
</row>{
"initial": { "count": 0 },
"update": {
"increment": { "count": "count + 1" },
"decrement": { "count": "count - 1" },
"reset": { "count": "0" }
}
}Markup can bind and dispatch. It cannot mutate. Every state change goes through update.
- Closed markup dialect close to Native SDK views:
row/column/for/if/{bindings}/on-press="done:{h.id}", design tokens, templates. - Predictable state. Events produce messages; messages update a JSON model; the view is derived.
- Deterministic software renderer. Rounded rects + a public-domain 8×8 font, PNG-encoded with no compression crate. Same inputs, same bytes.
- A real window.
nativum runhosts the same surface in an OS window. Clicks and keys become messages. - Headless when you want it.
check,render,snapshot,replay,testnever open a window.run --frames 1presents once and exits (CI / xvfb). - Agent-friendly snapshot. Every frame dumps an accessibility tree with roles, frames, and bound actions.
- Showcase apps in
apps/: counter, calculator, notes, habits.
Not in v0.1 (on purpose): GPU presentation, a TypeScript core transpiler, WebView, packaging. The loop and the pixels come first.
| Path | What |
|---|---|
crates/nativum-core |
Values, tokens, geometry, messages |
crates/nativum-markup |
.native parser, expression language, checker |
crates/nativum-engine |
Expand, layout, paint, JSON cores, session |
crates/nativum-cli |
nativum binary |
crates/nativum |
Facade crate |
apps/ |
Zero-config showcase apps |
docs/DESIGN.md |
Architecture and non-goals |
Apache-2.0. See LICENSE.