mola-sitegen-wren logo
mola-sitegen-wren

Wren, Zig, HTML IR, WASM

Official Project Site

Wren authors it. Zig runs it.

mola-sitegen-wren is a focused example project. It shows how a Zig host can expose mola-sitegen1 HTML IR to Wren for static generation, then reuse Zig again in the browser through WebAssembly.

What ships

One stack, two runtimes

  • Static pages

    Wren and Zig build the landing pages into dist/.

  • Live browser logic

    The Hacker News section and demo form run through app.wasm.

  • Thin JS host

    JavaScript only attaches browser events, fetch, and DOM updates.

4

Example content records still backing the project copy

3

Top-level pages in the new information architecture

1

Browser-side WASM runtime

1

Shared HTML IR model across build time and runtime

Why this exists

A practical example

The point of this repository is to show an understandable composition of mola-sitegen1, mola-wren, Zig, and WebAssembly. The site should feel like an official project surface for that stack, not like a random UI kit.

Static first

Pages ship as normal HTML files and work without a server runtime.

Runtime where needed

Only the demo page hydrates live behavior through WASM.

Shared primitives

Both static and dynamic rendering use the same Zig HTML IR.

Useful snippet

Static page registration

Code example

Wren entrypoint

The top-level Wren file still owns the static site map.

import "sitegen" for Site
import "pages" for Pages

Site.asset("assets/app.js", "assets/app.js")
Site.asset("zig-out/wasm/app.wasm", "assets/app.wasm")

Site.page("/", "mola-sitegen-wren", "Official project site.", Pages.home(posts))
Site.page("/architecture/index.html", "Architecture", "How the project is put together.", Pages.architecture(posts))
Site.page("/demo/index.html", "Demo", "Live Zig/WASM demos.", Pages.demo(posts))

Site.build("dist")

Stack overview

Each layer has a job

mola-sitegen1

Defines the HTML IR, rendering, and asset/page emission.

mola-wren

Embeds Wren and exposes the foreign boundary into Zig.

Wren

Authors the pages, layout, and content-level structure.

Zig/WASM

Runs the interactive demo logic in the browser.