Register routes in bootstrap/app.php

Laravel 11 and newer register routes, middleware, and the health URL in bootstrap/app.php. Do not add Http/Kernel.php back.

For your AI agent

Copies a prompt. Paste it into the AI agent you already have open.

Read https://laravel-vuejs.space/laravel-bootstrap-app-php.md
Laravel 11 and newer register routes, middleware, and the health URL in bootstrap/app.php. Do not add Http/Kernel.php back.
Do not copy a Kernel.php from an old tutorial into this app.
Do not point the Vue pages at routes/api.php so they "go through bootstrap".
Show the diff. Do not commit.
On this page · 3 sections
  1. The fix
  2. What to avoid
  3. FAQ

People searching “Laravel bootstrap/app.php” follow a Laravel 10 article and create app/Http/Kernel.php. On Laravel 11, 12, and 13 the application builder is bootstrap/app.php. The setup guide is the kit that already has this file.

TL;DR

  • Laravel 11 and newer register routes, middleware, and the health URL in bootstrap/app.php.
  • Do not add Http/Kernel.php back.
  • Do not copy a Kernel.php from an old tutorial into this app.
  • Do not point the Vue pages at routes/api.php so they “go through bootstrap”.

Who it's for: Laravel + Vue developers

Applies to: Laravel 13 · Vue 3

The fix#

php
return Application::configure(basePath: dirname(__DIR__))
    ->withRouting(
        web: __DIR__.'/../routes/web.php',
        commands: __DIR__.'/../routes/console.php',
        health: '/up',
    )
    ->withMiddleware(function (Middleware $middleware) {
        //
    })
    ->withExceptions(function (Exceptions $exceptions) {
        //
    })->create();

Web routes, including Inertia, stay in routes/web.php. Middleware aliases go in the withMiddleware callback. You do not get a $routeMiddleware array anymore.

What to avoid#

Gotcha

Do not copy a Kernel.php from an old tutorial into this app. The framework will not read it. Do not point the Vue pages at routes/api.php so they “go through bootstrap”. They are web routes.

FAQ#

How do I register routes in bootstrap/app.php?

Laravel 11 and newer register routes, middleware, and the health URL in bootstrap/app.php. Do not add Http/Kernel.php back.

What goes wrong with Laravel bootstrap/app.php?

Many developers follow a Laravel 10 article and create app/Http/Kernel. Do not copy a Kernel.php` from an old tutorial into this app.

Found this useful?

Ask questions, share what you built.

Join thousands of Laravel and Vue developers in our Facebook group, or get new posts in your Telegram feed. Sharing this article helps too.

Keep reading

Newsletter

Get the best of Laravel & Vue, once a month.

One short email with new guides, release notes worth reading and hand-picked community links. No spam, unsubscribe any time.