`runique start`
The runique start command is the entry point of the admin workflow.
Detecting the admin in `main.rs`
On startup, runique start reads src/main.rs and looks for the presence of .with_admin(:
// src/main.rs
RuniqueApp::builder(config)
.with_admin(|a| a.routes(admins::routes("/admin")))
// ...
Detection is done by simple string search in the source file.
It works even if the line is commented out (// .with_admin(...)).
| Detection result | Behaviour |
|---|---|
.with_admin( found | Generation + cargo run chained |
| Absent | Info message, clean exit |
The path to
main.rsis configurable:runique start --main src/main.rs
What happens when `.with_admin(` is detected
runique start runs, in order, on the same thread:
- Generation β reads
src/admin.rs, parsesadmin!{}, rewritessrc/admins/ cargo fmt --allcargo run --releaseβ blocking until program exit
runique start
βββ generate_admin(src/admin.rs) β rewrites src/admins/
βββ cargo fmt --all
βββ cargo run --release β HTTP server (blocking)
An earlier design ran generation on a separate thread in parallel with cargo run: this created a race condition (the build could pick up a half-written admin.rs, failing unreproducibly). The flow is now strictly sequential to eliminate that. There is no continuous watching: to regenerate after changing src/admin.rs, run runique start again.
Related sections
| Section | Description |
|---|---|
| Admin code generation | Generated files |
Macro admin! | Declaring administrable resources |