litestar-inertia

Integrates Inertia.js server-driven SPAs with Litestar and litestar-vite for React, Vue, or Svelte.

Updated Aug 17, 2026
One-click install
npx skills add https://github.com/renjianguo666/litecms --skill litestar-inertia-renjianguo666
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: litestar-inertia
Source: https://github.com/renjianguo666/litecms/tree/main/.agents/skills/litestar-inertia
Command: npx skills add https://github.com/renjianguo666/litecms --skill litestar-inertia-renjianguo666

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Building a React, Vue, or Svelte single-page app backed by a Python Litestar server requires wiring four layers together: the Inertia client adapter, the Vite build pipeline, the litestar-vite bridge, and Litestar route handlers. This Skill guides that integration end-to-end so page components, shared props, forms, and validation errors flow correctly between Python and the browser. ## Core Features & Use Cases - Inertia route handlers: Return Inertia pages from Litestar controllers using component= decorators, with shared static, session, and request-time props configured through InertiaConfig. - Forms and validation: Use useForm on the client with Litestar ValidationException field errors automatically mapped into the client's errors object, plus CSRF handled transparently. - Performance patterns: Apply partial reloads, lazy props, and deferred props so pages only fetch the data they need, with TypeScript page-props types generated from Python schemas via TypeGen. - Use Case: Build an authenticated dashboard where Litestar guards protect routes, session-backed currentUser props are shared across all pages, and a project creation form displays server-side validation errors without writing any JSON API endpoints. ## Quick Start Ask the AI to scaffold a Litestar app with VitePlugin and InertiaConfig that renders a React dashboard page component with a useForm-based creation form.

Frequently Asked Questions about litestar-inertia

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I return an Inertia page from a Litestar route handler?

Add the component parameter to your route decorator, such as @get("/", component="dashboard/Index"), and return a dict or schema of page props. The component name maps to a file under resources/js/pages, like resources/js/pages/dashboard/Index.tsx.

How do I handle form validation errors with Inertia and Litestar?

Use useForm on the client and raise a Litestar ValidationException with a dict of field errors on the server. The errors automatically populate the errors object returned by useForm, with CSRF tokens handled transparently.

Does litestar-vite Inertia support React, Vue, and Svelte?

Yes, the integration works with @inertiajs/react, @inertiajs/vue3, and @inertiajs/svelte adapters. However, you must pick one framework per project because mixing frameworks breaks Inertia's page resolver.

How do I share auth user data across all Inertia pages?

Set extra_session_page_props in InertiaConfig, for example extra_session_page_props={"currentUser": CurrentUser}, so the value is pulled from request.session on every page. For request-time additions, call share(request, key, value) before returning the response.

When should I not use Inertia with Litestar?

Avoid Inertia for JSON-API-only SPAs, HTMX apps, or non-Litestar backends. If you need both API and Inertia routes, separate them by prefix such as /api/* for JSON and /dashboard/* for Inertia pages.

Why does my Inertia app force full page reloads after deployment?

Inertia tracks an asset version and forces a full reload when versions mismatch between client and server. Let litestar-vite generate the version hash from the asset manifest instead of hand-rolling your own version string.