Inertia.js lets you build modern React, Vue 3, and Svelte 5 single-page applications using classic server-side routing and controllers. Instead of building a separate REST or GraphQL API for every screen, your Litestar route handlers declare component="Users/Index" and return Python dict, msgspec.Struct, dataclass, or Pydantic models directly.
The browser sends a standard HTTP request without an X-Inertia header.
InertiaResponse serializes the PageProps JSON envelope into <script type="application/json" id="app_page" data-page="app"> (or the legacy data-page attribute on #app when use_script_element=False).
When InertiaConfig(ssr=True) is enabled, Litestar Vite pre-renders the initial HTML via the SSR IPC transport before returning the page.
Subsequent Client Navigation:
Clicking an Inertia <Link> or calling router.visit() sends an XHR/Fetch request with X-Inertia: true and X-Inertia-Version.
Litestar detects the Inertia visit and returns application/json containing only the PageProps envelope, swapping the page component in place without a full browser reload.
Deferred Props & Partial Reloads:
Props wrapped in defer() are omitted from the initial response and listed in deferredProps.
Immediately after mounting the initial page, the Inertia client fires batched background partial reloads to resolve each deferred group.
Mutations & Asset Version Rotation:
Following POST, PUT, PATCH, or DELETE requests, InertiaMiddleware converts 302 redirects into 303 See Other so the browser follows up with a GET request.
If the frontend bundle hash changes between deployments (X-Inertia-Version mismatch), Litestar responds with 409 Conflict and X-Inertia-Location, prompting a clean full-page reload.