Skip to main content
Kit integrates Inertia.js to provide a seamless way to build modern single-page applications using React, without the complexity of building an API.

What is Inertia.js?

Inertia.js is a protocol that bridges your server-side framework with a client-side SPA framework. Instead of building a separate API:
  • Server returns page components with their props
  • Client renders React components using those props
  • Navigation happens via XHR, updating the page without full reloads
This gives you the best of both worlds: server-side routing and controllers with a reactive frontend.

Architecture

Project Structure

A Kit application with Inertia has the following structure:

How It Works

1. Initial Page Load

When a user visits your app for the first time:
  1. Browser requests /
  2. Kit controller returns an HTML document containing:
    • The Inertia page data as JSON in the root element
    • Links to your compiled React app
  3. React boots and renders the initial page component

2. Subsequent Navigation

When clicking links or submitting forms:
  1. Inertia intercepts the navigation
  2. Makes an XHR request with X-Inertia: true header
  3. Kit returns JSON with the new page component and props
  4. Inertia swaps the component without a full page reload

Getting Started

Create a New Project

This scaffolds a complete project with Inertia and React pre-configured.

Start Development Server

This starts both the Rust backend and Vite dev server with hot module replacement.

Your First Inertia Response

In a controller, return an Inertia response:
Create the corresponding React component at frontend/src/pages/Home.tsx:

Development vs Production

Development Mode

In development, Kit:
  • Serves React assets through Vite’s dev server (http://localhost:5173)
  • Enables hot module replacement for instant updates
  • Provides detailed error messages

Production Mode

For production, build and serve optimized assets:

Key Benefits

Next Steps