You add Navi to a Rust UI application in three steps: declare the crates, select your framework through a quoin feature, and wire route-tree generation into build.rs.
Prerequisites
Section titled “Prerequisites”- Rust 1.85+ (edition 2024).
- A UI framework supported by quoin: GPUI, Dioxus, Leptos, Xilem, or Floem.
1. Add the crates
Section titled “1. Add the crates” [dependencies] navi-router = { path = "../navi/navi-router" } navi-macros = { path = "../navi/navi-macros" } quoin = { path = "../quoin/quoin", features = ["gpui"] } cargo add navi-router --path ../navi/navi-router cargo add navi-macros --path ../navi/navi-macros cargo add quoin --path ../quoin/quoin --features gpui2. Select your framework
Section titled “2. Select your framework”The framework is a feature flag on quoin. The route table, components, loaders, and devtools do not change when you switch.
| Framework | quoin feature | Bootstrap style |
|---|---|---|
| GPUI | gpui |
run_app!(App) |
| Dioxus | dioxus |
LaunchBuilder::desktop().launch(app) |
| Leptos | leptos |
mount_to_body on wasm32-unknown-unknown |
| Xilem | xilem |
run_app!(App) |
| Floem | floem |
run_app!(App) |
Enabling the gpui feature automatically enables gpui-rsx-classes, which keeps GPUI subtrees reachable through quoin’s rsx! escape hatch.
3. Wire up code generation
Section titled “3. Wire up code generation”Create navi.config.json in your project root (see the config reference for every key):
{ "routes_directory": "./src/routes", "generated_route_tree": "./src/route_tree.gen.rs", "route_token": "route", "index_token": "index", "route_file_ignore_prefix": "-"}Then call the generator from build.rs:
fn main() { let config = navi_codegen::NaviConfig::from_file("navi.config.json") .expect("Failed to read config"); navi_codegen::generator::write_route_tree(&config).unwrap();}4. Verify
Section titled “4. Verify”Build the workspace and confirm the generated file appears:
cargo buildls src/route_tree.gen.rsThe generated module exposes build_route_tree() and register_routes(), which you use to boot the router — see Getting Started for the full bootstrap.
