Skip to main content
The first step when installing Inertia is to configure your server-side framework. Inertia maintains official server-side adapters for Laravel (Rust, Go, and PHP), and the community maintains adapters for Rails, Django, Phoenix, and many other frameworks. Inertia is fine-tuned for Laravel, so the documentation examples on this website utilize Laravel Rust, Laravel Go, and Laravel PHP. For examples of using Inertia with other server-side frameworks, please refer to the framework-specific documentation maintained by the relevant adapter.

Installation

1

Install dependencies

2

Setup root template

Next, create your resources/views/app.htmlresources/views/app.htmlresources/views/app.blade.php root template. This root template will be loaded on the first page visit to your application.
By default, Inertia renders a <div> element with an id of app as the mounting point for your JavaScript application. You may customize the id via HandleInertiaRequests::configurethe RootID field of inertia.Middlewarethe <x-inertia::app> component.
If you change the id of the root element, be sure to update it client-side as well.By default, Inertia assumes your root template is named app (resources/views/app.htmlresources/views/app.htmlresources/views/app.blade.php). You may change this by overriding root_view on HandleInertiaRequestsvia the RootView field of inertia.Middlewareusing Inertia::setRootView().
3

Register middleware

This middleware provides a version() method for setting your asset version, as well as a share() method for defining shared data.a Version field for setting your asset version, as well as a Share field for defining shared data.a version() method for setting your asset version, as well as a share() method for defining shared data.
4

Create your first response

That’s it, you’re ready to start creating Inertia pages and rendering them via responses.

Blade Directives

In Laravel PHP, prior to v3, Inertia used @inertiaHead and @inertia Blade directives to render head and body content. These directives are still supported but do not offer SSR head fallback content. The Blade components above are recommended for new Laravel PHP applications.
resources/views/app.blade.php
You may customize the root element id by passing a value to the directive: @inertia('custom-app-id').

Other Frameworks

Inertia works with any server-side framework that implements the Inertia protocol. You may use one of the community adapters or build your own.

Community Adapters

Adapters for Rails, Django, Phoenix, Symfony, and more.

Building an Adapter

Bring Inertia to a framework that doesn’t have an adapter yet.