1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
//! veer — Inertia.js v3 server-side protocol for Rust.
//!
//! Build classic server-rendered apps that drive React, Vue, or Svelte frontends
//! through the official Inertia.js client adapters — no separate JSON API needed.
//!
//! See <https://inertiajs.com/the-protocol> for the protocol spec.
//!
//! # Quick start (axum)
//!
//! ```no_run
//! use veer::{Inertia, InertiaConfig, InertiaLayer, MinimalRootView};
//! use axum::{Router, routing::get};
//!
//! # async fn run() {
//! let config = InertiaConfig::new()
//! .version(|| "1".into())
//! .root_view(MinimalRootView::new().title("Acme").vite_entry("/src/main.tsx"));
//!
//! let app: Router = Router::new()
//! .route("/", get(|inertia: Inertia| async move {
//! inertia.render("Home", serde_json::json!({ "msg": "hello" }))
//! }))
//! .layer(InertiaLayer::new(config));
//! # }
//! ```
//!
//! # Feature flags
//!
//! | Flag | Default | Purpose |
//! |------|---------|---------|
//! | `axum` | on | Axum extractor + tower layer |
//! | `ssr` | off | HTTP SSR client backed by `reqwest` |
//! | `cookie-session` | off | Signed-cookie session store |
//! | `validator` | off | `IntoErrorBag` impl for `validator::ValidationErrors` |
//! | `garde` | off | `IntoErrorBag` impl for `garde::Report` |
//!
//! # Architecture
//!
//! - Protocol core: pure data + decision logic, no I/O. Lives in
//! [`protocol`], [`page`], [`props`], [`request`].
//! - Pluggable traits: [`RootView`], [`SessionStore`], [`SsrClient`],
//! [`SharedProps`] — implement your own or use the built-ins.
//! - Adapters: [`adapters::axum`] under the `axum` feature.
//!
//! # Caveats
//!
//! - `Always<T>` and `Merge<T>` wrappers are detected at any depth inside a
//! typed `Serialize` value, but only top-level matches affect the Inertia
//! wire format (the protocol has no notion of "nested merge prop").
//! - When building props with the `serde_json::json!` macro, wrappers are
//! collapsed into raw values before they reach `Inertia::render` — they
//! only survive via typed `#[derive(Serialize)]` structs. Use
//! [`InertiaResponse::merge`] to mark top-level keys built via `json!`.
pub use InertiaConfig;
pub use VeerError;
pub use Inertia;
pub use PageObject;
pub use ;
pub use RequestInfo;
pub use InertiaResponse;
pub use ;
pub use ;
pub use SharedProps;
pub use ;
pub use ;
pub use UploadedFile;
pub use MultipartStream;