///
Ztack is an innovative and comprehensive web framework designed to empower developers to build full-stack applications entirely in Zig. It aims to eliminate the traditional "context switch" problem of
50 views
~50 views from guests
Guest views are estimated from total page views. These include anonymous visitors and users who weren't logged in when they viewed the page.
Ztack is an innovative and comprehensive web framework designed to empower developers to build full-stack applications entirely in Zig. It aims to eliminate the traditional "context switch" problem often faced by web developers who have to juggle different languages and ecosystems for backend and frontend development (e.g., a backend in Go/Rust and a frontend in TypeScript/JavaScript). With Ztack, you can write your server logic, database interactions, HTML generation, and even client-side browser event handlers all in the powerful, performant, and type-safe Zig language.
At its heart, Ztack allows you to leverage Zig's strengths across the entire web stack. This means a more unified development experience, fewer mental overheads switching between language paradigms, and the potential for higher performance and reliability from end-to-end. By providing tools for both server-side and client-side concerns within a single language, Ztack streamlines development and reduces the complexity typically associated with modern web applications.
Ztack brings a suite of powerful features to achieve its full-stack vision:
data-on attributes, which Ztack integrates with a small event delegation script, reducing boilerplate and improving performance.Getting started with Ztack is straightforward. After cloning the repository, you can build and run the provided examples:
These commands will compile the Zig projects and launch a local server demonstrating Ztack's capabilities.
The Ztack codebase is organized to separate concerns and provide clear examples:
src/modules/: Contains the core framework components, including:
router.zig: The HTTP routing framework.html.zig: HTML generation utilities and builders.transpiler.zig: The Zig-to-JavaScript transpilation logic.js.zig: JavaScript Abstract Syntax Tree (AST) definitions.dom.zig: Abstraction for browser DOM APIs.src/examples/: Showcases how to use the framework with various practical applications:
router_server.zig: A basic routing demonstration.improved_counter.zig: A full-featured example demonstrating HTML builders, event delegation, and streaming.wasm_simple_server.zig: An example leveraging WebAssembly.For a deeper dive into Ztack, refer to the following guides within the repository: