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.

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.