Skip to the workspace
Pebellslearn by building
Getting Started with Laravel  ›  Lesson

Laravel for Full Stack and Frontend

Laravel for Full Stack 12 minLaravel can build the whole app, rendering pages on the server with Blade or pairing with Livewire or Inertia, or it can act as a pure backend API for a separate frontend.

laravel / Laravel for Full Stack and Frontend

Explore each scene at your own pace.

01 · The rule

The rule

Laravel for Full Stack and Frontend

People describe Laravel as a "backend framework", then show you a Laravel app with polished pages and buttons. Both are true. Laravel can own the whole app, or it can hand the screen to someone else and only serve data. Knowing which shape you are in tells you where the HTML comes from.

The rule

Ask who draws the HTML: Laravel, or a separate frontend.

Full stack: Laravel draws the page. A request reaches a controller, the controller loads data and returns a view. The view is a Blade template, which is HTML with a few extra tags, and Laravel turns it into finished HTML on the server:

Route::get('/books', function () {
    return view('books.index', ['books' => Book::all()]);
});

Laravel still takes care of the frontend here: it compiles your CSS and JavaScript with Vite and adds them through the @vite directive in your layout.

Two tools push the full-stack shape further:

  • Livewire lets you write interactive components in PHP. Clicking a button sends a small request to the server, and the changed part of the page is updated. You write little or no JavaScript.
  • Inertia keeps Laravel's routes and controllers but lets React or Vue components draw each page. The controller passes data straight to the component, with no separate API to design.

API only: someone else draws the page. Laravel returns JSON, and a separate app, such as a Next.js site or an iPhone app, fetches it and builds the screen:

Route::get('/api/books', function () {
    return Book::all();
});

Returning a model collection like this makes Laravel send it as JSON automatically.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.