veer 0.1.1

Inertia.js v3 server-side protocol superset for Rust
Documentation
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
<div align="center">

<img src=".github/veer.webp" alt="Veer" width="100%" />

# Veer

**The Inertia.js server-side protocol superset, for Rust.**

Build modern single-page apps in React, Vue, or Svelte β€” without writing a JSON API, a client-side router, or a single `fetch`. Your Rust handlers return typed props, and the frontend hydrates as if the page was server-rendered. Because it was.

[![Discord](https://img.shields.io/badge/Discord-Join%20Us-5865F2?style=for-the-badge&logo=discord&logoColor=white)](http://go.climactic.co/discord)
[![Latest Version on crates.io](https://img.shields.io/crates/v/veer.svg?style=for-the-badge)](https://crates.io/crates/veer)
[![GitHub CI Status](https://img.shields.io/github/actions/workflow/status/climactic/veer/ci.yml?branch=main&label=ci&style=for-the-badge)](https://github.com/climactic/veer/actions?query=workflow%3Aci+branch%3Amain)
[![docs.rs](https://img.shields.io/docsrs/veer?style=for-the-badge)](https://docs.rs/veer)
[![MSRV 1.85](https://img.shields.io/badge/MSRV-1.85-blue?style=for-the-badge)](https://www.rust-lang.org)
[![Sponsor on GitHub](https://img.shields.io/badge/Sponsor-GitHub-ea4aaa?style=for-the-badge&logo=github)](https://github.com/sponsors/climactic)
[![Support on Ko-fi](https://img.shields.io/badge/Support-Ko--fi-FF5E5B?style=for-the-badge&logo=ko-fi&logoColor=white)](https://ko-fi.com/ClimacticCo)

</div>

## πŸ“– Table of Contents

- ✨ [What is Inertia, and why a Rust adapter]#-what-is-inertia-and-why-a-rust-adapter
- πŸ“¦ [Installation]#-installation
- πŸš€ [Quick Start]#-quick-start
- 🍳 [Cookbook]#-cookbook
- πŸŽ›οΈ [Feature Flags]#️-feature-flags
- πŸ—οΈ [Architecture]#️-architecture
- ⚠️ [Caveats]#️-caveats
- πŸ§ͺ [Example App]#-example-app
- πŸ—ΊοΈ [Status & Roadmap]#️-status--roadmap
- πŸ™Œ [Acknowledgements]#-acknowledgements
- πŸ§ͺ [Testing]#-testing
- πŸ“‹ [Changelog]#-changelog
- 🀝 [Contributing]#-contributing
- πŸ”’ [Security Vulnerabilities]#-security-vulnerabilities
- πŸ’– [Support This Project]#-support-this-project
- ⭐ [Star History]#-star-history
- πŸ“„ [License]#-license

## ✨ What is Inertia, and why a Rust adapter

[Inertia.js](https://inertiajs.com) is a glue layer that lets a classic server-rendered backend drive a modern SPA frontend. The server returns a page object (component name + props); the official Inertia client adapter for React/Vue/Svelte takes care of mounting the component, hydrating props, intercepting links, and making subsequent navigations into JSON XHRs.

`veer` is a clean-room Rust implementation of the server side of the [Inertia v3 protocol](https://inertiajs.com/the-protocol). It targets [axum](https://github.com/tokio-rs/axum) out of the box; the protocol core is framework-agnostic, so adapters for other Rust web frameworks slot in beside it.

```text
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                       β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚  Rust handler           β”‚  ── page object ──▢   β”‚  Inertia client (JS)    β”‚
   β”‚  inertia.render(...)    β”‚       (JSON)          β”‚  React / Vue / Svelte   β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                       β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β–²                                                  β”‚
              └─────────────  navigation XHR  β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

**Highlights**

- πŸ¦€ Pure Rust server-side implementation of Inertia v3
- ⚑ First-class [axum]https://github.com/tokio-rs/axum adapter (extractor + tower layer)
- 🧩 Framework-agnostic protocol core β€” drop new adapters in beside the axum one
- πŸ“¦ Partial reloads, deferred props, merge props, encrypted/clear history
- πŸ–₯️ SSR via `@inertiajs/server` (Node or Bun) with graceful fallback
- βš™οΈ Vite dev + production manifest integration that mirrors Laravel's `@vite`
- πŸ“€ File uploads via typed `InertiaForm` + a streaming `MultipartStream` extractor
- βœ… Validation flash for `validator` and `garde`, plus a cookie-based session store
- πŸͺ’ End-to-end TypeScript bindings: typed page props + Ziggy-style route helpers, generated from Rust

## πŸ“¦ Installation

Add `veer` to your `Cargo.toml`:

```toml
[dependencies]
veer = "0.1"
```

Or with `cargo add`:

```bash
cargo add veer
```

The default feature set includes the axum adapter. See [Feature flags](#️-feature-flags) for everything else.

## πŸš€ Quick Start

```rust,no_run
use axum::{routing::get, Router};
use veer::{Inertia, InertiaConfig, InertiaLayer, MinimalRootView};

#[tokio::main]
async fn main() {
    let cfg = InertiaConfig::new()
        .version(|| "1".into())
        .root_view(
            MinimalRootView::new()
                .title("Acme")
                .vite_entry("/src/main.tsx"),
        );

    let app = Router::new()
        .route("/", get(|inertia: Inertia| async move {
            inertia.render("Home", serde_json::json!({ "msg": "hello" }))
        }))
        .layer(InertiaLayer::new(cfg));

    let listener = tokio::net::TcpListener::bind("0.0.0.0:3000").await.unwrap();
    axum::serve(listener, app).await.unwrap();
}
```

The `Inertia` extractor reads the request. `render(component, props)` returns a builder. The layer handles the rest of the protocol β€” initial HTML on first load, JSON on XHR navigations, 409 for asset-version mismatches, 303 for POST-redirects, version checks, partial reloads.

## 🍳 Cookbook

<details>
<summary><b>Validation + flash, Laravel-style</b></summary>

```rust,ignore
async fn users_create(
    inertia: Inertia,
    InertiaForm(body): InertiaForm<NewUser>,
) -> impl IntoResponse {
    if let Err(errors) = body.validate() {
        return inertia.with_errors(errors).redirect("/users/new");
    }
    create_user(body).await;
    inertia
        .redirect("/users")
        .with_flash("success", serde_json::json!("User created"))
}
```

`InertiaForm` accepts `application/json`, `application/x-www-form-urlencoded`, and (with the `multipart` feature) `multipart/form-data`. The same handler works regardless of how the Inertia client serialized the request.

On the frontend, `usePage().props.errors` and `usePage().props.flash` are auto-populated whenever a `SessionStore` is configured β€” no extra wiring.

</details>

<details>
<summary><b>File uploads</b></summary>

Enable the `multipart` feature and add `UploadedFile` fields to your typed struct:

```rust,ignore
use veer::{InertiaForm, UploadedFile};

#[derive(serde::Deserialize)]
struct CreateAvatar {
    user_id: String,
    avatar: UploadedFile,
}

async fn upload_avatar(
    inertia: Inertia,
    InertiaForm(form): InertiaForm<CreateAvatar>,
) -> impl IntoResponse {
    save_avatar(&form.user_id, &form.avatar.bytes, form.avatar.filename.as_deref()).await;
    inertia.redirect("/profile").with_flash("success", json!("Avatar updated"))
}
```

Inertia's `useForm` automatically switches to `multipart/form-data` when any field is a `File` or `Blob`. The same handler accepts JSON when no file is attached and multipart when one is β€” no separate route required.

For large or unbounded uploads where in-memory buffering isn't acceptable, use `MultipartStream` instead:

```rust,ignore
use veer::MultipartStream;

async fn huge_upload(MultipartStream(mut m): MultipartStream) -> impl IntoResponse {
    while let Some(field) = m.next_field().await.unwrap() {
        // pipe field.chunk().await into S3, disk, wherever β€” no buffering
    }
    // ...
}
```

</details>

<details>
<summary><b>External redirect (OAuth, billing, etc.)</b></summary>

```rust,ignore
async fn oauth_start(inertia: Inertia) -> impl IntoResponse {
    inertia.location("https://accounts.google.com/o/oauth2/v2/auth?...")
}
```

Returns 409 + `X-Inertia-Location`. The Inertia client honors this with a hard navigation.

</details>

<details>
<summary><b>Partial reloads, lazy & deferred props</b></summary>

```rust,ignore
inertia
    .render("Users/Index", serde_json::json!({ "users": users }))
    .lazy("stats", || async { json!({ "hits": load_stats().await }) })
    .deferred("expensive", "dashboard", || async { json!(load_expensive().await) })
    .merge("notifications")
```

| Method | Behavior |
|---|---|
| `lazy(key, closure)` (alias `optional`) | Closure only runs when the client requests this key via a partial reload |
| `deferred(key, group, closure)` | First response advertises the key under `deferredProps[group]`; client then issues a follow-up reload that resolves it |
| `merge(key)` | Marks the key so the client merges the value into existing state instead of replacing |
| `encrypt_history()` / `clear_history()` | Set the Inertia v2+ history-state primitives |
| `no_ssr()` | Skip SSR for this response only |

</details>

<details>
<summary><b>Shared props (auth, app name, feature flags)</b></summary>

```rust,ignore
use veer::shared::shared_props_fn;

let cfg = InertiaConfig::new()
    .shared(shared_props_fn(|_req| async move {
        serde_json::json!({
            "auth": { "user": current_user().await },
            "app": { "name": "Acme" },
        })
    }));
```

Shared props merge under per-response props (handler props win on key collision).

</details>

<details>
<summary><b>SSR via @inertiajs/server (Node or Bun)</b></summary>

Enable the `ssr` feature and point at the SSR service:

```rust,ignore
use veer::ssr::http::HttpSsrClient;

let cfg = InertiaConfig::new()
    .ssr(HttpSsrClient::new("http://127.0.0.1:13714/render"));
```

SSR failures fall back to client-side rendering by default. Set `ssr_required(true)` for hard-fail behavior.

For end-to-end SSR you'll usually combine this with `ViteRootView` (next entry) β€” `ViteRootView` inlines the SSR body verbatim and emits the `<script data-page>` mount the Inertia v3 client expects.

</details>

<details>
<summary><b>Vite integration (dev + production)</b></summary>

`ViteRootView` is a drop-in `RootView` that mirrors what Laravel's `@vite` + `@viteReactRefresh` Blade directives do. Two modes:

**Dev** β€” cross-origin script tags pointing at the Vite dev server, plus (opt-in) the React refresh preamble required when the HTML shell is served off-origin:

```rust,ignore
use veer::ViteRootView;

let cfg = InertiaConfig::new()
    .root_view(
        ViteRootView::dev()
            .title("Acme")
            .entry("frontend/app.tsx")
            .dev_server("http://localhost:5173")
            .react_refresh(true), // needed for @vitejs/plugin-react cross-origin
    );
```

**Production** β€” `vite build` writes `dist/.vite/manifest.json`. `ViteRootView::production` walks it from the entry, emitting the entry script, its CSS, and `<link rel="modulepreload">` hints for transitively imported chunks:

```rust,ignore
use veer::{ViteManifest, ViteRootView};

let manifest = ViteManifest::load("dist/.vite/manifest.json")?;
let version  = manifest.hash(); // changes whenever any chunk hash changes

let cfg = InertiaConfig::new()
    .version(move || version.clone().into()) // bumps client asset cache on rebuild
    .root_view(
        ViteRootView::production()
            .title("Acme")
            .entry("frontend/app.tsx")
            .manifest(manifest)
            .asset_base("/build"),
    );

// Serve the built bundle next to the routes:
// .nest_service("/build", tower_http::services::ServeDir::new("dist"))
```

Wiring `version` to `manifest.hash()` means any rebuild auto-invalidates clients via the Inertia 409 + force-reload protocol β€” no manual version bumps.

For SSR in production, build the sidecar with `vite build --ssr frontend/ssr.tsx` and run the resulting bundle (`bun dist/ssr/ssr.js` or `node …`). Same `:13714/render` interface as dev.

</details>

<details>
<summary><b>End-to-end TypeScript bindings (Wayfinder-style)</b></summary>

Enable the `ts` feature and the frontend gets an auto-generated `gen/` directory containing every page's props type, a discriminated `Pages` union, and one TypeScript module per controller with method-aware URL builders.

```toml
[dependencies]
veer = { version = "0.1", features = ["ts"] }
ts-rs = "10"
```

Annotate each prop struct and register it as a page:

```rust,ignore
use serde::Serialize;
use ts_rs::TS;

#[derive(Serialize, TS)]
#[ts(export)]
#[serde(rename_all = "camelCase")]
pub struct UsersIndexProps {
    pub users: Vec<User>,
}
veer::register_page!(UsersIndexProps, "Users/Index");
```

Then build your router using `veer::Router` β€” same fluent API as `axum::Router`, but every route gets a name and method so the codegen knows about it:

```rust,ignore
use veer::Method::*;

pub fn router() -> veer::Router<AppState> {
    veer::Router::new()
        .named_route(GET,    "users.index",   "/users",      users_index)
        .named_route(GET,    "users.show",    "/users/:id",  users_show)
        .named_route(GET,    "users.create",  "/users/new",  users_create)
        .named_route(POST,   "users.store",   "/users",      users_store)
        .named_route(PATCH,  "users.update",  "/users/:id",  users_update)
        .named_route(DELETE, "users.destroy", "/users/:id",  users_destroy)
}

// In main():
let app = router().build().with_state(state).layer(InertiaLayer::new(cfg));
```

`build()` returns a regular `axum::Router`, so `.with_state` / `.layer` / `.merge` / anything else just works. Same-path multi-method calls (GET + POST on `/users`) are merged into a single `MethodRouter` automatically β€” no panic on duplicate paths.

`ts-rs` mirrors `#[serde(rename_all)]` into the generated TypeScript, so the same struct drives both wire format and type. Route names follow the Laravel resource convention (`index`/`show`/`create`/`store`/`update`/`destroy`) so they don't collide with JavaScript reserved words.

Add a tiny binary that builds the router (so the runtime route registry populates) and then emits the bundle. Drop this in `src/bin/gen-bindings.rs` inside your app crate β€” `cargo` auto-discovers it:

```rust,ignore
// src/bin/gen-bindings.rs
fn main() {
    let _ = my_app::router().build();   // populate registry
    veer::bindings::generate_split("./frontend/gen").unwrap();
}
```

Generate with:

```bash
cargo run --bin gen-bindings
```

The codegen has to run inside *your* app binary (not a standalone CLI), because the route registry is populated at runtime by `Router::build()` and the page registrations are link-time `inventory` submissions β€” both only exist in your compiled crate.

On the frontend, import types and the per-controller action module:

```tsx,ignore
import { usePage, router, Link } from "@inertiajs/react";
import { users, type UsersIndexProps } from "./gen";

export default function Index() {
  const { props } = usePage<UsersIndexProps>();
  return (
    <>
      <Link href={users.create.url()}>New user</Link>
      {props.users.map((u) => (
        <Link key={u.id} href={users.show.url({ id: u.id })}>{u.name}</Link>
      ))}
    </>
  );
}
```

Each action is a callable with `.url` and `.form` helpers:

| Call | Returns |
|---|---|
| `users.show({id: 1})` | `{ url: "/users/1", method: "get" } as const` (visit definition) |
| `users.show.url({id: 1})` | `"/users/1"` (just the path string) |
| `users.show.form({id: 1})` | `{ action: "/users/1", method: "get" } as const` (props for `<form>`) |

Generated layout:

```text
frontend/gen/
  index.ts              protocol types, Pages, prop types, action namespace re-exports
  actions/
    users.ts            export const index, show, create, store, update, destroy
    posts.ts            …
    _root.ts            routes without a dotted prefix
```

`Always<T>` and `Merge<T>` collapse to `T` on the TypeScript side β€” the protocol's `mergeProps` / `deferredProps` arrays in the envelope carry the marker information instead.

**Customize the output layout** with the `Split` builder β€” rename the `actions/` subdirectory, add a filename prefix/suffix, or flatten everything into the root:

```rust,ignore
veer::bindings::Split::new("./frontend/gen")
    .actions_dir("controllers")    // -> frontend/gen/controllers/
    .file_suffix("-controller")    // -> users-controller.ts, posts-controller.ts
    .generate()?;
```

`actions_dir("")` writes the controller files directly alongside `index.ts`; `file_prefix` is similarly available.

**Need a single bundled file** instead of the split tree? Use [`bindings::generate("./frontend/inertia.gen.ts")`](https://docs.rs/veer/latest/veer/bindings/fn.generate.html) β€” same content, one file, with the route tree exposed as a nested `routes.users.show(...)` namespace.

**Auto-regenerate on commit** with [lefthook](https://github.com/evilmartians/lefthook). Add this to `lefthook.yml` at the repo root:

```yaml
pre-commit:
  commands:
    veer-bindings:
      glob: "*.rs"
      run: cargo run -q --bin gen-bindings
      stage_fixed: true
```

`stage_fixed: true` re-adds the regenerated TS files to the commit so they never drift from the Rust source. Run `lefthook install` once per dev machine. Pair with a CI job that runs `cargo run --bin gen-bindings && git diff --exit-code` on PRs to fail-fast if someone bypasses the hook.

</details>

<details>
<summary><b>Cookie-based flash session</b></summary>

For apps without an existing session crate:

```rust,ignore
use veer::session::cookie::CookieSessionStore;

let cfg = InertiaConfig::new()
    .session(CookieSessionStore::new(env_secret()).secure(true));
```

HMAC-SHA256-signed, constant-time verification, one-shot semantics. For anything more elaborate, implement the `SessionStore` trait over your existing session crate (`axum-login`, redis, …) in ~30 lines.

</details>

<details>
<summary><b>tower-sessions integration</b></summary>

If the app already runs `tower-sessions`, enable the `tower-sessions` feature and plug `TowerSessionStore` into the config. Flash data round-trips through whatever backend (Redis, Postgres, in-memory, …) tower-sessions is configured with.

```rust,ignore
use time::Duration;
use tower_sessions::{Expiry, MemoryStore, SessionManagerLayer};
use veer::{session::tower::TowerSessionStore, InertiaConfig, InertiaLayer};

let session_layer = SessionManagerLayer::new(MemoryStore::default())
    .with_expiry(Expiry::OnInactivity(Duration::minutes(30)));

let cfg = InertiaConfig::new().session(TowerSessionStore::new());

let app = axum::Router::new()
    // … routes …
    .layer(InertiaLayer::new(cfg))
    .layer(session_layer); // tower-sessions must wrap *outside* InertiaLayer
```

Flash is stored under a single key (`_veer_flash` by default; override with `TowerSessionStore::new().key("...")`).

</details>

## πŸŽ›οΈ Feature Flags

| Flag | Default | Effect |
|------|---------|--------|
| `axum` | **on** | Axum extractor + tower layer + `InertiaForm` body extractor |
| `multipart` | off | File upload support (`UploadedFile`, `MultipartStream`) |
| `ssr` | off | HTTP SSR client (`reqwest`) |
| `cookie-session` | off | Signed-cookie one-shot flash store |
| `tower-sessions` | off | Flash store backed by [`tower-sessions`]https://crates.io/crates/tower-sessions |
| `validator` | off | `IntoErrorBag` impl for `validator::ValidationErrors` |
| `garde` | off | `IntoErrorBag` impl for `garde::Report` |
| `ts` | off | End-to-end TypeScript bindings codegen (`ts-rs` + `inventory`) |

Disabling a feature drops its transitive deps entirely.

## πŸ—οΈ Architecture

```text
β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚  axum Router                                           β”‚
β”‚  β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  β”‚
β”‚  β”‚ InertiaLayer                                     β”‚  β”‚
β”‚  β”‚   β”œβ”€ reads flash from SessionStore               β”‚  β”‚
β”‚  β”‚   β”œβ”€ injects config into request extensions      β”‚  β”‚
β”‚  β”‚   └─ on response: finalizes InertiaResponse,     β”‚  β”‚
β”‚  β”‚      writes flash, rewrites 302β†’303 on non-GET   β”‚  β”‚
β”‚  β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  β”‚
β”‚                       β”‚                                β”‚
β”‚                       β–Ό                                β”‚
β”‚        β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”                   β”‚
β”‚        β”‚  Inertia (extractor)      β”‚                   β”‚
β”‚        β”‚  inertia.render(...) β†’    β”‚                   β”‚
β”‚        β”‚  InertiaResponse builder  β”‚                   β”‚
β”‚        β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜                   β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β”‚
              β–Ό
   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   β”‚  Protocol core (framework-agnostic)  β”‚
   β”‚  β€’ RequestInfo / PageObject          β”‚
   β”‚  β€’ decide() state machine            β”‚
   β”‚  β€’ prop resolver (partial reloads,   β”‚
   β”‚    deferred groups, merge keys)      β”‚
   β”‚  β€’ Pluggable: RootView, SessionStore,β”‚
   β”‚    SsrClient, SharedProps            β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
```

The protocol core has zero I/O and zero framework deps β€” pure data structures and decision functions, exhaustively unit-tested. Adapters for other Rust frameworks (actix, rocket, salvo) can sit beside the axum one without touching it.

## ⚠️ Caveats

> `Always<T>` and `Merge<T>` are detected at any depth and through any serialization path β€” typed `#[derive(Serialize)]` structs, `serde_json::json!`, hand-built `Value`s, mixed maps. Only top-level matches affect the Inertia wire format though, because the protocol has no notion of a "nested merge prop". Wrappers placed deeper are still stripped from the JSON sent to the client; they just don't appear in `mergeProps`.

## πŸ§ͺ Example App

A complete end-to-end demo lives at [`examples/axum-react-todo/`](examples/axum-react-todo) β€” axum backend + React/Vite frontend, with validation, flash messages, and an in-memory todo store.

```bash
# Terminal 1 β€” Rust backend
cargo run -p axum-react-todo

# Terminal 2 β€” Vite dev server
cd examples/axum-react-todo
bun install
bun dev
```

## πŸ—ΊοΈ Status & Roadmap

`veer` is pre-1.0. The v0.1 protocol surface is complete (all Inertia v3 features: partial reloads, deferred props, merge props, encrypted/clear history, SSR, asset versioning, validation flash). Planned for follow-ups:

- Adapters for `actix-web` and `rocket`
- Typed route-param inference (today: `string | number`; goal: read each handler's `Path` extractor and emit the matching TS type)

Contributions, bug reports, and protocol-conformance fixtures welcome.

## πŸ™Œ Acknowledgements

The protocol is [Inertia.js](https://inertiajs.com) by Jonathan Reinink and contributors. `veer` is an independent server-side implementation for Rust, modeled on the Laravel adapter's behavior.

## πŸ§ͺ Testing

```bash
cargo test --all-features
```

## πŸ“‹ Changelog

Please see [CHANGELOG](CHANGELOG.md) for more information on what has changed recently.

## 🀝 Contributing

Please see [CONTRIBUTING](CONTRIBUTING.md) for details.
You can also join our Discord server to discuss ideas and get help: [Discord Invite](http://go.climactic.co/discord).

## πŸ”’ Security Vulnerabilities

Please report security vulnerabilities to [security@climactic.co](mailto:security@climactic.co).

## πŸ’– Support This Project

Veer is free and open source, built and maintained with care. If this crate has saved you development time or helped power your application, please consider supporting its continued development.

<a href="https://github.com/sponsors/climactic">
    <img src="https://img.shields.io/badge/Sponsor%20on-GitHub-ea4aaa?style=for-the-badge&logo=github" alt="Sponsor on GitHub" />
</a>
&nbsp;
<a href="https://ko-fi.com/ClimacticCo">
    <img src="https://img.shields.io/badge/Support%20on-Ko--fi-FF5E5B?style=for-the-badge&logo=ko-fi&logoColor=white" alt="Support on Ko-fi" />
</a>

### 🌟 Sponsors

<!-- sponsors -->
*Your logo here* β€” Become a sponsor and get your logo featured in this README and on our website.
<!-- sponsors -->

**Interested in title sponsorship?** Contact us at [sponsors@climactic.co](mailto:sponsors@climactic.co) for premium placement and recognition.

## ⭐ Star History

<a href="https://star-history.com/#climactic/veer&Date">
 <picture>
   <source media="(prefers-color-scheme: dark)" srcset="https://api.star-history.com/svg?repos=climactic/veer&type=Date&theme=dark" />
   <source media="(prefers-color-scheme: light)" srcset="https://api.star-history.com/svg?repos=climactic/veer&type=Date" />
   <img alt="Star History Chart" src="https://api.star-history.com/svg?repos=climactic/veer&type=Date" />
 </picture>
</a>

## πŸ“„ License

Dual-licensed under **MIT** or **Apache 2.0** at your option. Please see [`MIT`](LICENSE-MIT) and [`APACHE`](LICENSE-APACHE) for more information.