Laravel Starter Kits
Laravel’s starter kits provide out-of-the-box scaffolding for new Inertia applications.These starter kits are the absolute fastest way to start building a new Inertia project using Laravel and Vue or React. However, if you would like to manually install Inertia into your application, please consult the documentation below.
Installation
1
Install dependencies
First, install the Inertia server-side adapter using the Composer package manager.
2
Setup root template
Next, create a For React applications, it’s recommended to include the If you change the
resources/views/app.blade.php file. This root template will be loaded on the first page visit to your application, and should include your assets along with the @inertia and @inertiaHead directives.resources/views/app.blade.php
@viteReactRefresh directive before the @vite directive to enable Fast Refresh in development.The @inertia directive renders a <div> element with an id of app. This element serves as the mounting point for your JavaScript application. You may customize the id by passing a different value to the directive.id of the root element, be sure to update it client-side as well.By default, Inertia’s Laravel adapter will assume your root template is named app.blade.php. If you would like to use a different root view, you can change it using the Inertia::setRootView() method.3
Register middleware
Next we need to setup the Inertia middleware. You can accomplish this by publishing the Once the middleware has been published, append the This middleware provides a
HandleInertiaRequests middleware to your application, which can be done using the following Artisan command.HandleInertiaRequests middleware to the web middleware group in your application’s bootstrap/app.php file.version() method for setting your asset version, as well as a share() method for defining shared data.