Zero Native: Zig shell for 2.9MB web-native apps

Better Stackgo watch the original →

Zero Native scaffolds Vite/React projects into Zig-hosted native apps using system webview, delivering 2.9MB binaries, hot reload dev server, and direct C/OS API access via JSON bridges.

The Breakthrough

Zero Native scaffolds Zig-based native app projects that host Vite frontends in a thin shell using the system's webview or bundled Chromium, yielding binaries of 2.9MB with instant dev rebuilds.

What Actually Worked

  • Install Zig via mise or brew, then Zero Native; run zero native init <name> --frontend react (or vue, next, vite) to generate app.zon config, build.zig, JS bridge, web engine, assets, and frontend directories.
  • Execute zig build run to install dependencies and launch the app; use zig build dev to start a dev server that recompiles the binary and hot-reloads the native app on frontend code edits.
  • Edit app.zon to set icon path, project name, web engine (system webview or Chromium), and window dimensions.
  • Communicate between webview JavaScript and native Zig layer via JSON bridges to access OS APIs and C libraries through direct imports without glue code.
  • Run zig build package to produce distributable binaries in zig-out/package, such as a 2.9MB macOS app.

Before / After

  • Zero Native binaries measure 2.9MB, with some configurations under 1MB.
  • ElectroBun requires a Bun web worker plus FFI via C++ and Objective-C layers atop a Zig starter binary, creating a thicker shell than Zero Native's pure Zig binary.

Context

JavaScript developers seek lightweight alternatives to Electron for desktop and mobile apps. The video demonstrates Zero Native setup on an existing Vite project by copying code into the frontend directory, highlights Zig's readability and C interop for JS devs, and contrasts it with ElectroBun's TypeScript main process. The result enables tiny, fast native apps; open-source nature allows prompting Claude for custom features like system trays or mobile support.

Notable Quotes

  • "providing super tiny binaries and instant rebuilds for development"
  • "Zig... no borrow checker no lifetimes and can call C directly meaning any C library is a single import away without needing any glue code"
  • "the thinnest native shell possible compared to Electrobun"

Content References

  • #demo
  • #tutorial
  • #review

summary by x-ai/grok-4.1-fast. probably wrong about something. check the source.