Skip to content

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.

  • Rust 1.85+ (edition 2024).
  • A UI framework supported by quoin: GPUI, Dioxus, Leptos, Xilem, or Floem.
[dependencies]
navi-router = { path = "../navi/navi-router" }
navi-macros = { path = "../navi/navi-macros" }
quoin = { path = "../quoin/quoin", features = ["gpui"] }

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.

Create navi.config.json in your project root (see the config reference for every key):

navi.config.json
{
"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:

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();
}

Build the workspace and confirm the generated file appears:

Terminal
cargo build
ls src/route_tree.gen.rs

The generated module exposes build_route_tree() and register_routes(), which you use to boot the router — see Getting Started for the full bootstrap.