Laravel and Inertia in Practice: SPA Feel Without an API

Inertia lets a Laravel app behave like a single-page app without a separate API: how it works, how I structure it, and when not to use it.
In Short
- Inertia is a thin layer between Laravel and a client framework such as React or Vue. Controllers return page components with props instead of JSON from an API.
- You keep server-side routing, validation, sessions and policies, and still get navigation without full page reloads.
- It fits apps where one team owns both sides. It does not fit when other clients need a public API.
What Is Inertia?
Inertia.js is a protocol and a small set of adapters that connect a server-side framework to a client-side one. In a Laravel app, a controller ends with Inertia::render('Invoices/Index', [...]) instead of returning a Blade view or a JSON resource. The named page is a React, Vue or Svelte component, and the array becomes its props. There is no REST or GraphQL layer to design, version and secure.
How Does Inertia Work?
- The first request returns a full HTML document with the page component's name and props embedded.
- After that, links are intercepted. The client requests the next URL with an
X-Inertiaheader and the server answers with JSON: component name, props, URL and asset version. - The client swaps the component and updates the browser history. The address bar, the back button and deep links behave as they do on a classic site.
- When the asset version changes after a deploy, Inertia forces a full reload so nobody runs stale JavaScript.
How I Structure Pages
- One folder per resource under
Pages/, mirroring the routes:Invoices/Index,Invoices/Show,Invoices/Edit. - Persistent layouts for the shell, so the sidebar and its state survive navigation.
- Controllers send only what the page renders. An Eloquent model passed whole exposes every column to the browser, so I map to arrays or API resources first.
- Authorization stays in policies on the server. The props carry simple flags such as
can.update; the client only decides what to show.
Forms and Validation
Inertia's form helper keeps the form state, the processing flag and the errors together. I submit with it, validate with a Laravel form request, and when validation fails Laravel redirects back and the errors arrive as props, exactly as in a Blade app. There is no hand-written error mapping and no second set of validation rules in JavaScript.
Shared Data, Partial Reloads and Deferred Props
- Shared data. The
HandleInertiaRequestsmiddleware shares what every page needs: the signed-in user, flash messages, permissions. Keep it small, because it travels with every response. - Partial reloads. A filter or a pagination link can ask for only the props that change.
- Lazy and deferred props. Expensive data can be left out of the first response and loaded right after the page renders.
When Not to Use Inertia
- A mobile app or third parties need the same data: build the API, and let the web client use it too.
- The public pages depend on search traffic and you do not want to run server-side rendering for them. Blade, or a prerendered site like this one, is simpler.
- The front end and the back end are owned by separate teams with separate release cycles.
For the admin panels and client portals that make up much of agency work, none of those apply, and that is where I reach for Laravel with Inertia first.
Questions and Answers
Is Inertia a Framework?
No. It is the glue between a server framework and a client framework. Routing, controllers and data access stay in Laravel.
Does Inertia Need an API?
No. Controllers return page props directly; authentication uses the normal Laravel session.
Is Inertia Good for SEO?
Pages are rendered in the browser unless you enable server-side rendering. For content that has to rank, turn SSR on or serve those pages another way.