Expand description
The UI, compiled into the binary.
Principle 4 says a single binary with no operational overhead. A UI served
from a sidecar, a CDN or an unpacked asset directory is a second thing to
deploy, version and get out of sync with the API it talks to — so the built
bundle is include_bytes!d and the binary grows by exactly the size of the
files. Three of them, listed by name: Vite is configured with fixed output
names and no code splitting, because content hashes in filenames would mean
regenerating this table on every build.
dist/ is checked into git. That is the trade: cargo build never needs
node, and npm run build is a step a developer takes before committing a UI
change. The alternative — a build.rs that shells out to npm — makes every
Rust build depend on a JavaScript toolchain to produce bytes that did not
change.
Freshness is an ETag over the bytes rather than a hash in the URL. The hash is computed once on first use, the browser sends it back on the next load, and an unchanged bundle costs three 304s — the ETag is per asset, so a page load revalidates each of the three — instead of 60 KB.
Macros§
- asset 🔒
Structs§
- Asset 🔒
Statics§
- ASSETS 🔒