You want a Laravel 13 app with a Vue 3 page showing data from your database, and you want it before your coffee goes cold. This guide goes from an empty folder to exactly that, with every command in order.
TL;DR
laravel new blog, answer yes to a starter kit and pick Vue: login, Inertia 3, TypeScript and Tailwind are wired up.composer run devstarts PHP, the queue, logs and Vite in one command.- A controller returns
Inertia::render('posts/Index', [...]); the Vue page types those props withdefineProps. No API to build.
You need PHP 8.3+, Composer and Node.js (see what you need).
- Install the Laravel installer.
- Create the project with the Vue starter kit.
- Start the dev servers.
- Add a model with a migration, factory and seeder.
- Add a route and a controller.
- Write the Vue page.
- Test it.
Step 1: install the Laravel installer#
composer global require laravel/installerMake sure Composer’s global bin directory is on your PATH, so the laravel command is available.
Step 2: create the project#
laravel new blogThe installer asks a few questions. Answer yes to a starter kit.
Gotcha: the defaults are not Vue
The starter kit default is no. Saying no, then picking Vue, installs Vue with no login. On the stack question, the default is React.
| Question | Answer |
|---|---|
| Starter kit? | Yes |
| Starter kit stack | Vue |
| Authentication | Laravel’s built-in authentication |
| Teams | No, unless you want them |
Pest is installed for you. Pass --phpunit if you want PHPUnit instead. The installer does not show a testing-framework question.
It then installs Composer and npm dependencies, creates a SQLite database and runs the first migrations. The Vue kit ships with Inertia 3, Vue 3, TypeScript, Tailwind CSS 4 and shadcn-vue.
Step 3: start the dev servers#
cd blog
composer run devThis one command starts the PHP server, the queue worker, the log viewer and Vite with hot reload. Open http://localhost:8000 and you will see the welcome page, with working Log in and Register links.
Step 4: add a model#
Create a Post model with a migration, a factory and a seeder:
php artisan make:model Post -mfsDescribe the table in the new migration:
public function up(): void
{
Schema::create('posts', function (Blueprint $table) {
$table->id();
$table->string('title');
$table->string('slug')->unique();
$table->text('excerpt');
$table->timestamp('published_at')->nullable();
$table->timestamps();
});
}Let the model be filled in bulk, and give the factory some fake data:
class Post extends Model
{
use HasFactory;
protected $fillable = ['title', 'slug', 'excerpt', 'published_at'];
protected function casts(): array
{
return ['published_at' => 'datetime'];
}
}public function definition(): array
{
$title = fake()->sentence();
return [
'title' => $title,
'slug' => str($title)->slug(),
'excerpt' => fake()->paragraph(),
'published_at' => now(),
];
}public function run(): void
{
Post::factory()->count(12)->create();
}Run the migration and seed the table:
php artisan migrate
php artisan db:seed --class=PostSeederStep 5: add a route and a controller#
php artisan make:controller PostControlleruse App\Models\Post;
use Inertia\Inertia;
use Inertia\Response;
class PostController extends Controller
{
public function index(): Response
{
return Inertia::render('posts/Index', [
'posts' => Post::query()
->latest('published_at')
->get(['id', 'title', 'slug', 'excerpt', 'published_at']),
]);
}
}use App\Http\Controllers\PostController;
Route::get('/posts', [PostController::class, 'index'])->name('posts.index');Step 6: write the Vue page#
Inertia passes the controller’s data to the page as props. With <script setup> and TypeScript, they are fully typed:
<script setup lang="ts">
import { Head } from "@inertiajs/vue3";
interface Post {
id: number;
title: string;
slug: string;
excerpt: string;
published_at: string;
}
defineProps<{ posts: Post[] }>();
</script>
<template>
<Head title="Posts" />
<main class="mx-auto max-w-3xl space-y-6 p-8">
<h1 class="text-3xl font-semibold">Posts</h1>
<article v-for="post in posts" :key="post.id" class="rounded-xl border p-6">
<h2 class="text-xl font-medium">{{ post.title }}</h2>
<p class="mt-2 text-muted-foreground">{{ post.excerpt }}</p>
</article>
</main>
</template>Visit http://localhost:8000/posts. Vite reloads the page as you edit, and Laravel serves the data. There is no separate API to build.
The logged-in user is already shared#
The Vue starter kit already shares the logged-in user from HandleInertiaRequests.php as auth.user. A layout reads it with usePage().props.auth.user.
Gotcha: new secret columns
The default User model hides password, two_factor_secret, two_factor_recovery_codes, and remember_token with the Hidden attribute. A secret column you add later goes on that same attribute, or you share only(['id', 'name', 'email']) instead of the whole model.
The title template and a meta description are the document title guide. The shell that stays mounted between those pages is the persistent layout guide.
Step 7: test it#
Write and run the first test
use App\Models\Post;
it('lists posts', function () {
Post::factory()->create(['title' => 'Hello Laravel 13']);
$this->get('/posts')
->assertOk()
->assertInertia(fn ($page) => $page
->component('posts/Index')
->has('posts', 1)
);
});php artisan testRegister routes and middleware#
Laravel 11 and newer register routes, middleware, and the health URL in bootstrap/app.php. The starter kit already has this file. You do not get app/Http/Kernel.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.
Gotcha
Do not copy a Kernel.php from a Laravel 10 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.
Format PHP with Pint before you commit#
vendor/bin/pint --dirty--dirty limits Pint to git’s dirty files. Commit after you have looked at the diff. Pint rewrites spacing and imports. It does not change a query’s meaning on purpose, but you still read the diff.
Vue, TypeScript, and CSS are not Pint’s job. The kit’s frontend formatter, if you have one, is a different command.
Gotcha
Do not commit vendor/. Pint lives there after composer install. CI can run vendor/bin/pint --test so a bad format fails the build without rewriting the branch.
Install Telescope for local debugging#
Telescope records request bodies, including Inertia props and the session. That is useful on your machine. It is not a product feature, and the Vue page should not iframe it.
composer require laravel/telescope --dev
php artisan telescope:install
php artisan migrateThe published TelescopeServiceProvider gates viewTelescope. Leave that gate on local. Do not return true for every user so a Vue admin link can open it. Do not require Telescope without --dev and then try to prune it later. CI does not need the UI.
Commit an env example, not the secrets file#
.env has the app key and the database password. It stays off the git remote. Commit .env.example instead, with the key names and empty secrets:
APP_NAME=Laravel
APP_KEY=
APP_URL=http://localhost
VITE_APP_NAME="${APP_NAME}"A teammate copies it to .env and fills it in. APP_KEY is generated with php artisan key:generate. You do not invent one and you do not reuse production’s. Vite only sees VITE_ keys; the Vite guide is which of those values the browser is allowed to see.
Gotcha
Do not prefix a secret with VITE_ so the example “also works in Vue”. That ships the secret. Do not add .env to the repo and gitignore it later. It is already in history. Rotate the key that leaked.
Recap#
laravel new blog+ Vue starter kit = auth, Inertia 3, Vue 3, TypeScript and Tailwind on day one.composer run devruns everything you need locally.make:model Post -mfsgives you the migration, factory and seeder in one go.- Controllers send props with
Inertia::render; pages type them withdefineProps. - Routes and middleware live in
bootstrap/app.php, notHttp/Kernel.php. - Format PHP with
vendor/bin/pint --dirty, keep Telescope and.envoff the remote, and commit.env.example.
FAQ#
Why did laravel new install Vue without a login screen?
You answered no to the starter kit question. Run it again and answer yes, then pick Vue.
Do I need to build an API for the Vue page?
No. With Inertia, the controller passes data to the page as props. You only need an API for other clients.
How do I use PHPUnit instead of Pest?
Pass --phpunit to laravel new. The installer does not ask about the testing framework.
Which database does a new Laravel app use?
SQLite, created for you by the installer. Switch to MySQL, MariaDB or PostgreSQL when production needs it.
Do I need app/Http/Kernel.php in Laravel 13?
No. Register routes, middleware, and the health URL in bootstrap/app.php. The framework will not read a Kernel.php copied from a Laravel 10 tutorial.
Should I commit .env so the next laptop works?
No. Commit .env.example with empty secrets. Generate a new APP_KEY on each machine with php artisan key:generate.
Can I install Telescope in production to watch Inertia requests?
No. Keep it a dev dependency and leave the viewTelescope gate on local. It records request bodies, including passwords if you are not careful.
Next steps#
- Add create, edit, delete, search, and pagination in the CRUD guide.
- Upload a cover image in the file upload guide.
- Choose Inertia, a separate Vue SPA, or Nuxt in which Laravel and Vue stack to use.
- Run
npm run buildfor production. The deploy guide covers the SSR build, the queue, and thepublic/hotfile.
Looking for the original Laravel 5 + Nuxt 2 setup of this site? It is in the repository’s Git history, from before the Astro migration.
Sources#
- Laravel 13: Installation
- Laravel 13: Starter kits
- Inertia v3: Pages
- Inertia v3: Testing
- Laravel Vue starter kit
- Laravel docs: Routing
- Laravel docs: Middleware
- Laravel 11 release notes: application structure
- Laravel docs: Pint
- laravel/pint on GitHub
- Laravel docs: Telescope local only installation
- Laravel docs: Telescope
- Laravel docs: Environment configuration
- Vite docs: Env variables



