KING BON
← Journal

·2 min read

Laravel with React or Vue: Inertia, or a separate API?

Two good ways to pair a Laravel back end with a modern front end. When each one fits, and the questions I ask before choosing.

Laravel / React / Vue / Architecture

Laravel pairs well with React, Vue or Angular, but there are two quite different ways to connect them. Pick the wrong one and you either build a lot of plumbing you didn’t need, or you hit a wall when the second app arrives.

Option 1: Inertia, one app

Inertia lets Laravel controllers return React or Vue page components directly, with their data:

public function index()
{
    return Inertia::render('Bookings/Index', [
        'bookings' => BookingResource::collection(Booking::latest()->paginate(20)),
    ]);
}

You keep Laravel’s routing, middleware, session login, validation and redirects, and get a modern component-based front end without writing an API.

Good fit when:

  • there’s one web app, and the same team builds both sides
  • you want to move fast on dashboards, admin panels and internal tools
  • you’d rather not deal with tokens, CORS and API versioning yet

Option 2: a separate API

Laravel serves JSON only, and the front end is an independent app, sometimes hosted elsewhere:

Route::middleware('auth:sanctum')->get('/bookings', function () {
    return BookingResource::collection(Booking::latest()->paginate(20));
});

Good fit when:

  • a mobile app, a partner integration or a second front end will use the same data
  • separate teams own the front end and back end
  • the front end has its own deployment and hosting needs

The cost is real: authentication tokens or cookie setup across domains, CORS, API documentation, versioning, and duplicate validation for good error messages.

The questions I ask

  1. Will anything other than this website need the data in the next year? A mobile app is the most common answer that tips it toward an API.
  2. Who’s building it? One full-stack developer or a small team usually moves faster with Inertia.
  3. How important is SEO? Inertia supports server-side rendering. A separate single-page app needs extra work for public, indexable pages.

You can have both

These aren’t mutually exclusive. A common path: start with Inertia for the main web app, and add a small, versioned API with Sanctum tokens later when the mobile app arrives. Keeping data formatting in API Resources from day one makes that step easy, because both the Inertia pages and the API can reuse the same classes.

Choose the simplest setup that fits what you know today, and keep the door open for what’s likely tomorrow.