Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
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 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.

The shortcut

Follow one request to the end and ask "what arrives at the browser from Laravel: HTML or JSON?" HTML means full stack. JSON means Laravel is the backend for a frontend that lives somewhere else.

Placing three versions of LendlyStep 1 of 4
  1. Blade pages

    The browser receives finished HTML from Laravel. Full stack.

The trap is thinking Inertia makes Laravel "just an API". With Inertia there are no hand-built API endpoints. The controller still chooses the page and its data.

Drills

Answer fast — trust the rule.

quick drill

A Laravel route returns view('books.index'). Who draws the HTML?

quick drill

Lendly needs an Android app and a website sharing one backend. Which shape fits best?

quick drill

What does Livewire let you do?

quick drill

Which statement about Inertia is true?

Remember

  • Ask who draws the HTML: Laravel (full stack) or a separate frontend (API).
  • Blade, Livewire and Inertia are all full-stack shapes, and JSON endpoints make Laravel a backend.
  • Trap: Inertia is not an API. Controllers still choose the page.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainPick Lendly's shape

Describe two ways Lendly could use Laravel: one where Laravel renders the pages and one where it only serves data. Say who draws the HTML in each case and when you would choose the second.