what

Custom Logic (Bundle)

The What framework covers CRUD, auth, forms, state, and authorization from HTML and config. When you genuinely outgrow that (a custom integration, a background worker, business logic that shouldn't live in a template), run-what bundle is the official way down to Rust, without abandoning your HTML.

What it produces

run-what bundle turns your project into a standalone Rust project:

run-what bundle

You get a bundle/ directory containing:

  • a Cargo.toml that depends on what-core from crates.io,
  • a src/main.rs that embeds every file in your project (via include_bytes!), extracts them at startup, and runs the What server,
  • all your .html, components, partials, config, and assets, archived inside the binary.

Only files inside your project are bundled. A link that points outside it stops the bundle with an error naming the link (links that stay inside the project are followed): copy the file into the project instead. A file the bundle cannot read stops it too, and so does an output folder inside site/ or another bundled folder, or one a link there points to. An earlier bundle is replaced only when the new one is complete.

The result is a single self-contained app: the framework engine, plus your project, plus a main.rs you own and can extend.

A single deployable binary

Add --compile to build a release binary in one step:

run-what bundle --compile

That runs cargo build --release and hands you one executable with your whole site embedded: no separate files to ship, nothing to install on the target. Point it at any host and run it.

The escape hatch to Rust

Because the bundle is a real Cargo project built on the what-core library, src/main.rs is your extension point. You keep the What engine, router, and all your HTML, and add exactly the Rust you need around it:

  • a custom route or webhook endpoint that the declarative layer can't express,
  • a background job or scheduled task alongside the server,
  • an integration with a service that needs real code,
  • custom middleware.

This keeps the framework's promise intact: you write HTML for everything HTML can do, and drop to Rust only for the genuinely-hard remainder, in a normal Cargo project, with the full ecosystem available, instead of contorting logic into templates.

Reach for this last, not first. Most apps never need it: polling, lazy loading, auth, ownership, and multi-tenant scoping are all declarative. But when you do outgrow HTML, the exit is a clean Cargo project, not a rewrite.