Zinto is a desktop application framework. It uses Zig for the backend and Svelte for the frontend. Bun manages the build toolchain.
adapter-static.turf.libxev.The application runs as a single native binary. The main thread manages the OS window and webview loop. A background thread runs the libxev event loop for non-blocking I/O.
Communication between Svelte and Zig uses a JSON-based message bridge. Zig uses comptime reflection to parse and dispatch commands.
Zig embeds the frontend production build directly into the binary. A custom URI scheme (zinto://) serves these assets from memory. The handler includes a fallback to index.html to support client-side routing.
/src: Zig backend source code.
main.zig: Entry point and window initialization.
bridge.zig: Comptime IPC dispatcher.
assets.zig: Embedded file map.
/frontend: Svelte project.
build.zig: Unified build script for Bun and Zig.
build.zig executes bun install and bun run build.frontend/dist and generates assets.zig.This repo now contains a working scaffold that matches the architecture described above:
src/ with:src/bridge.zig: JSON IPC + comptime API dispatch (starter ping + echo)src/assets.zig: placeholder asset server (overwritten by codegen)src/webview_stub.zig: stub webview adapter so the project has a runnable contract even before integrating a real webview librarysrc/async.zig: background worker thread (placeholder for a real libxev loop)frontend/ that builds to frontend/dist.From repo root:
Generate embedded assets + TypeScript API definitions:
zig build codegenBuild:
zig buildRun (stub webview prints the embedded index.html preview to stdout):
zig build runsrc/webview_stub.zig with a real implementation (e.g., turf/webview) and:zinto:// protocol handler to src/assets.zigsrc/bridge.zig and dispatch results back via the webview’s dispatch mechanismsrc/async.zig’s placeholder loop with a libxev event loop and message passing as described below.Initialize a native window using webview-zig. Bind the zinto:// protocol to the embedded asset map. Ensure the webview blocks the main thread.
Spawn a thread for libxev. Use an atomic queue to pass messages from the webview thread to the async thread. Use webview_dispatch to return results to the UI.
The build system must generate a TypeScript definition file (api.d.ts) based on the exported Zig functions in bridge.zig.