Laravel Inertia: What It Is, How It Works, and Why You Should Use It in Your Project

- Andrés Cruz - ES En español

Video thumbnail

When you start working with Laravel and want a truly fluid experience between backend and frontend, you inevitably end up looking at Inertia.js. And for good reason: it allows you to build an SPA without setting up a full REST API, without fighting with Vue Router, and without duplicating logic between client and server.

The first time I tried Inertia and created a new Laravel project with Inertia, I came from projects using Breeze and Blade, so I was amazed at how natural it felt to work with it... almost as if Laravel could render Vue natively. And that, precisely, is the key piece and main feature of this stack.

In this article, I will walk you through all the features of Laravel Inertia, how it works under the hood, and why it is gaining so much ground among Laravel developers.

What Laravel Inertia is and why it solves so many problems

The classic problem of SPAs with a separate API

The traditional SPA approach (API + JS client) carries two side effects that every Laravel developer knows well:

  • You have to duplicate concepts: routes in Laravel's routes/web.php and routes in Vue Router or React Router.
  • You lose native features like sessions, middlewares, or Laravel form validation, which you have to reimplement or manually coordinate on the client side.

Furthermore, setting up a complete CRUD ends up being more complex than necessary: part of it lives in Laravel, another part in the frontend... and those are two worlds that need to be kept in constant synchronization.

How Inertia blends the best of SSR and SPA

Inertia simplifies all of this by returning JavaScript components directly from Laravel controllers. You don't need a REST API to display data: Laravel passes props to the Vue (or React) component and you're good to go.

The magic happens because Inertia intercepts requests and prevents full page reloads. The result is an SPA experience—flicker-free navigation, preserved frontend state—but with all the simplicity of Laravel's server-side flow.

I remember when I reviewed my controllers for the first time, I thought: "this works just like Blade... except what gets rendered is a Vue component". And that's when I was completely sold. The beauty of Inertia is that it represents a very smooth evolution of what we already have in Laravel: we simply return a .vue component instead of a .blade.php view, with minimal changes to make everything work as expected.

What does Inertia offer us?

Building modern web applications is hard. Tools like Vue and React are extremely powerful, but the complexity they add to a fullstack developer's workflow can become disproportionate.

Integrating Vue into a Laravel project is not an especially difficult task—you can do it via npm or CDN and communicate both using a REST API—but the "problem" with that approach is that it involves working across many different layers and technologies and then interconnecting them all.

The classic workflow would be: Laravel with all its server logic, a REST API, views with Blade, and on top of that, a Vue project consuming that API using axios or fetch. It is a laborious path that we can considerably simplify and optimize with Inertia.

Keeping all the above in mind, Laravel Inertia is a complete adapter that simplifies the creation of dynamic interfaces without abandoning the comfort of Laravel. In short: it allows us to easily communicate Laravel with Vue (and vice versa) without needing an intermediate API.

What is Inertia and why compare it to Livewire?

It is inevitable to compare Inertia with Livewire. Both were born under the Jetstream umbrella, but over time they have taken very different paths. Formerly, Inertia felt like an add-on to Jetstream, but starting from version 1.0 (and now in 3.0), it has been integrated directly into the core of Laravel.

Today, when you install a new Laravel 13 project, Inertia is one of the official options in the installer. You can use it with:

  • Vue.js (the one we will use throughout this book).
  • React.
  • Svelte.

If we inspect a newly generated project with Laravel + Inertia, we will see in the package.json:

{
    "$schema": "https://www.schemastore.org/package.json",
    "private": true,
    "type": "module",
    "scripts": {
        "build": "vite build",
        "build:ssr": "vite build && vite build --ssr",
        "dev": "vite",
        "format": "prettier --write resources/",
        "format:check": "prettier --check resources/",
        "lint": "eslint . --fix",
        "lint:check": "eslint .",
        "types:check": "vue-tsc --noEmit"
    },
    "devDependencies": {
        "@eslint/js": "^9.19.0",
        "@stylistic/eslint-plugin": "^5.10.0",
        "@laravel/vite-plugin-wayfinder": "^0.1.3",
        "@tailwindcss/vite": "^4.1.11",
        "@types/node": "^22.13.5",
        "@vitejs/plugin-vue": "^6.0.0",
        ***
        "prettier-plugin-tailwindcss": "^0.6.11",
        "typescript": "^5.2.2",
        "typescript-eslint": "^8.23.0",
        "vite": "^8.0.0",
        "vue-tsc": "^2.2.4"
    },
    "dependencies": {
        "@inertiajs/vite": "^3.0.0",
        "@inertiajs/vue3": "^3.0.0",
        "@vueuse/core": "^12.8.2",
        "class-variance-authority": "^0.7.1",
        "clsx": "^2.1.1",
        "laravel-vite-plugin": "^3.0.0",
        "lucide-vue-next": "^0.468.0",
        "reka-ui": "^2.6.1",
        "tailwind-merge": "^3.2.0",
        "tailwindcss": "^4.1.1",
        "tw-animate-css": "^1.2.5",
        "vue": "^3.5.13",
        "vue-input-otp": "^0.3.2"
    },
    "optionalDependencies": {***
}

There are Vue and Inertia ready to go. If we check the composer.json, we will see its PHP counterpart:

"require": {
    "php": "^8.3",
    "inertiajs/inertia-laravel": "^3.0",
    "laravel/fortify": "^1.34",
    "laravel/framework": "^13.0",
    "laravel/tinker": "^3.0",
    "laravel/wayfinder": "^0.1.14"
},

Main features of Laravel Inertia (the complete list)

Here we will do what competitors don't do: a clear, complete, and well-explained list of everything Inertia brings.

Rendering with Inertia

The core of Inertia is simple: render Vue components (or React, if you prefer) instead of Blade files. From the controller, instead of returning view('users.show'), we return:

return Inertia::render('Users/Show', [
    'user' => $user
]);

And that's it. Laravel delivers a fully hydrated Vue/React component with the data, without needing an additional endpoint. The same happens across all application views: if you inspect the controllers, you will see that the names are quite descriptive and cover the complete authentication flow (login, registration, password recovery, etc.).

Props: direct server → client communication

Laravel sends data directly to the component as props, exactly the same way it would with variables in Blade. You don't need axios, fetch, or additional endpoints to hydrate the initial view. The controller is the single source of truth.

Views controlled by controllers

In Inertia, views are always rendered from controllers, just like in traditional Laravel with Blade. If you want to display something, you define a route, point to a controller, and from there call Inertia::render(). There is no extra magic or strange conventions: the flow is the usual one.

Middleware and global data with HandleInertiaRequests

Laravel includes a recommended middleware called HandleInertiaRequests. This middleware acts as an intermediary between the server and all components: it is the ideal place to pass global data, such as the authenticated user, translations, or flash messages.

Flash messages are those temporary notifications that appear after performing an action—for example, after successfully saving a form. By configuring them in HandleInertiaRequests, they become available across all views without needing to pass them manually in every controller.

Classic Laravel routing with an SPA experience

All your routes remain Laravel routes defined in routes/web.php. Inertia does not introduce its own routing system: it simply intercepts client-side navigation and turns it into an internal XHR request, preventing a full page reload. Result: SPA experience, Laravel architecture.

User model and authentication

The User model generated by Inertia is completely standard: it includes the Authenticatable, HasFactory, and Notifiable traits, just like in any Laravel project. Authentication works exactly the same as always; Inertia doesn't touch any part of this layer.

Where are the views?

If you check the resources/views folder, you will see that only a single Blade file exists. This causes confusion at first, but the explanation is simple: the other "views" are Vue components.

For every page you see in the browser, there is a component behind it. And they are organized very clearly:

  • Pages/: contains the full application pages.
  • Components/: contains the reusable pieces used to build those pages.

The structure is well-modularized and easy to navigate even in large projects.

Integration with Laravel authentication and sessions

Best of all: you change absolutely nothing. Sessions, middlewares, authentication guards... work exactly the same as always. When I rebuilt my login and registration system in Inertia, I practically reused the Blade logic, only transforming the views into Vue components.

Layouts and application structure

Inertia encourages a broad but very orderly structure. In addition to Pages/ and Components/, we have the Layouts/ folder, which contains global templates shared across pages.

The bootstrap file (app.ts or app.js) is where the application is initialized. Here we also find the project's only Blade file: app.blade.php. Inertia automatically tracks it as the main template, so you shouldn't move it or rename it.

  • /Pages → full pages
  • /Components → reusable pieces
  • /Layouts → global templates

Navigation with <Link> and smart XHR requests

Inertia replaces traditional HTML links with its own <Link> component:

<Link href="/posts/1">View post</Link>

When clicked, instead of reloading the page, Inertia fires an XHR request to the server, receives the new component with its props, and updates only the part of the UI that changes. The frontend state is preserved and the URL updates correctly.

Minimal state management without an external store

You don't always need Vuex, Pinia, or Redux. Inertia's "controller → props → component" pattern drastically reduces the need for a global store, because the server is always the single source of truth. This greatly simplifies application state and facilitates long-term maintenance.

App initialization with Inertia

App bootstrapping is similar to any Vue project, but using createInertiaApp() instead of createApp() directly. In this block we indicate:

  • The path where our pages are located (./pages/).
  • Where the components will be mounted (the DOM root element).
  • Additional plugins we need (such as the navigation progress bar).
createInertiaApp({
    title: (title) => `${title} - ${appName}`,
    resolve: (name) => resolvePageComponent(`./pages/${name}.vue`, import.meta.glob<DefineComponent>('./pages/**/*.vue')),
    setup({ el, App, props, plugin }) {
        createApp({ render: () => h(App, props) })
            .use(plugin)
            .use(Oruga)
            .use(CkeditorPlugin)
            .use(ZiggyVue)
            .mount(el);

All of this happens in the bootstrap file and you rarely need to touch it once configured.

Location and use of components

As we saw, pages are in Pages/ and reusable elements in Components/. Inertia automatically resolves which component to display based on the name you pass to Inertia::render(), so folder organization is important and it's best to keep it consistent from the start.

Form handling with Inertia

An important difference compared to a traditional Vue application is form handling. Here we do not use axios directly. Instead, Inertia provides us with the useForm composable:

const form = useForm({
    name: '',
    email: ''
});
form.post('/users');

We import useForm directly from @inertiajs/vue3 and it allows us to handle form state, submission, server validation errors, and loading states—all in a single object—without writing a single line of axios code or manually managing the server response.

Vue Router and Inertia in Laravel

Video thumbnail

With Laravel Inertia we automatically get an SPA (Single Page Application) type navigation: client-side rendering is handled by Vue, so traditional HTML links (<a href="...">) must not be used for internal navigation, as they cause a full page reload.

You can easily check this: if you place a conventional <a> link inside your app and click it, you'll see the entire page reload. What we want instead is for navigation to occur only within the application container—usually <div id="app">—updating only the corresponding component without reloading the layout or global state.

import { Link } from "@inertiajs/vue3"

When to use traditional links

Using <a href="..."> is not forbidden. It makes sense for external links, such as URLs to third-party pages or sites that are not part of our application. For any internal navigation, however, we should always use Inertia's <Link> component.

Inertia replaces Vue Router

In a standard Vue project you would use Vue Router to handle SPA navigation. With Inertia, Vue Router is not needed, because Inertia internally implements URL changes and component loading. If you combined them, both processes would overlap and generate conflicts that are difficult to debug. Therefore, Inertia provides its own <Link> component as a direct substitute.

Importing the Link component

In Vue 3, we import <Link> as follows:

import { Link } from "@inertiajs/vue3"

It is a named import, so we must respect the name Link as is. We cannot assign it an arbitrary alias like Link2, as it won't be recognized by Inertia:

// Incorrect
import { Link2 } from "@inertiajs/vue3" // This will throw an error

Once imported, we can use it inside our components the same way we would use an <a> in HTML:

import AppLayout from "@/Layouts/AppLayout.vue"

Basic usage of the Link component

Using <Link> is very simple. It works like a normal <a>, but maintains SPA navigation and integrates Ziggy's route() helper to generate typed URLs:

<Link class="text-sm text-purple-400 hover:text-purple-700"
     :href="route('category.edit', c.id)">
  Edit
</Link>
  • :href="route('category.edit', c.id)" generates the route URL using Ziggy's route() helper, which exposes Laravel's named routes to the frontend.

When clicked, the whole page does not reload: only the corresponding component is updated, the URL changes correctly, and the page title updates, respecting the expected behavior of an SPA.

You can also create links for other actions, such as navigating to the create view:

<Link class="link-button-default my-3" :href="route('category.create')">
  Create
</Link>

In short, with Inertia you get:

  • SPA navigation without reloading the entire page.
  • Easy, secure, and typed routing and URL management thanks to route().
  • Complete elimination of Vue Router for internal navigation.

This allows us to efficiently integrate navigation across all modules and components, keeping the application fast, fluid, and easy to maintain.

Real advantages of working with Laravel Inertia

Time savings compared to building API + SPA

  • You don't duplicate routes, you don't create API controllers, you don't configure axios services for every endpoint. The entire data flow passes through Laravel directly.
  • Minimal learning curve for Laravel developers. If you come from Blade, you feel at home from day one. That's exactly what happened to me: I started migrating views to Vue components and in one afternoon I had the complete flow set up and running.
  • Native integration with Vue, React, and Svelte. Since the backend delivers props directly to components, the frontend is extremely clean: no unnecessary global stores, no repetitive fetching logic.

When to choose Inertia.js over Blade or Livewire?

Quick comparison

  • Blade: perfect for traditional sites or applications with low client-side interactivity.
  • Livewire: ideal when you don't want to write JavaScript but need real-time reactivity.
  • Inertia: the best option for modern applications combining the solidity of Laravel with Vue, React, or Svelte on the frontend.

Recommended use cases

  • Administration panels and dashboards.
  • Complex CRUD systems.
  • Applications with complex server-side logic but highly dynamic views.
  • Projects where you want an SPA experience without the overhead of creating and maintaining a separate REST API.

Frequently asked questions about Laravel Inertia

  • Does Inertia replace Blade?
    • Not completely: in an Inertia project you will only need one Blade file (app.blade.php), which acts as an HTML shell. The rest of the views are Vue/React/Svelte components.
  • Can I use Inertia without Vue?
    • Yes, Inertia has official adapters for React and Svelte in addition to Vue.
  • Is it a good option for large projects?
    • Yes. Precisely because it keeps all business logic in Laravel and leaves the frontend modular and well-separated, it scales correctly.
  • What about SEO in an SPA with Inertia?
    • Inertia supports SSR (Server-Side Rendering) via a Node server. With SSR enabled, the server delivers rendered HTML to the search engine bot, solving the classic SPA indexing problem.

Conclusion

Laravel Inertia combines the best of the server and the client without forcing you to build a full REST API or a complex JS router. If you already work with Laravel, adopting Inertia feels almost natural: controllers, routes, middleware, validation... everything keeps working the same, but the frontend becomes much more dynamic and powerful.

In my experience, the learning curve is minimal and development becomes very agile: a login, a CRUD, or a dashboard can be set up in half the time compared to a traditional SPA with a separate REST API.

If you are looking for flexibility, speed, and a clean architecture that doesn't force you to abandon what you already know about Laravel, Inertia.js is one of the best options available in modern web development.

Discover what Inertia.js is in the context of Laravel, how it replaces Vue Router, how component rendering works, and when to choose it over Blade or Livewire. A complete guide with examples.


Únete a la comunidad de desarrolladores que han decidido dejar de picar código y empezar a construir productos reales. Recibe mis mejores trucos de arquitectura cada semana:

I agree to receive announcements of interest about this Blog.