# Set up a Laravel 13 + Vue 3 app in ten minutes

> Create a project with the official Vue starter kit, then add your first model, controller and typed Vue page with Inertia. Every command you need, start to finish.

- URL: https://laravel-vuejs.space/application-setup
- Author: Anass Ez-zouaine (https://laravel-vuejs.space/author/anass-ez-zouaine)
- Published: 2019-05-18
- Updated: 2026-11-10
- Topics: Laravel, VueJs, Inertia, Setup

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 dev` starts PHP, the queue, logs and Vite in one command.
> -   A controller returns `Inertia::render('posts/Index', [...])`; the Vue page types those props with `defineProps`. No API to build.
>
> **What you'll learn**
>
> -   How to create a project with the Vue starter kit
> -   How to add a model, migration, factory and seeder
> -   How a controller sends typed props to a Vue page
> -   How to test the page with Pest
>
> **Who it's for:** Developers starting their first Laravel + Vue app
>
> **Applies to:** Laravel 13 · Vue starter kit · Inertia 3 · Vue 3.5 · TypeScript · Pest

Sponsor

You need PHP 8.3+, Composer and Node.js (see [what you need](https://laravel-vuejs.space/requirements)).

1. **Install the Laravel installer.**
2. **Create the project** with the Vue starter kit.
3. **Start the dev servers.**
4. **Add a model** with a migration, factory and seeder.
5. **Add a route and a controller.**
6. **Write the Vue page.**
7. **Test it.**

## Step 1: install the Laravel installer

```bash
composer global require laravel/installer
```

Make sure Composer’s global `bin` directory is on your `PATH`, so the `laravel` command is available.

## Step 2: create the project

```bash
laravel new blog
```

The 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

```bash
cd blog
composer run dev
```

This 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:

```bash
php artisan make:model Post -mfs
```

Describe the table in the new migration:

`database/migrations/xxxx_xx_xx_create_posts_table.php`
```php
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:

`app/Models/Post.php`
```php
class Post extends Model
{
    use HasFactory;

    protected $fillable = ['title', 'slug', 'excerpt', 'published_at'];

    protected function casts(): array
    {
        return ['published_at' => 'datetime'];
    }
}
```

`database/factories/PostFactory.php`
```php
public function definition(): array
{
    $title = fake()->sentence();

    return [
        'title' => $title,
        'slug' => str($title)->slug(),
        'excerpt' => fake()->paragraph(),
        'published_at' => now(),
    ];
}
```

`database/seeders/PostSeeder.php`
```php
public function run(): void
{
    Post::factory()->count(12)->create();
}
```

Run the migration and seed the table:

```bash
php artisan migrate
php artisan db:seed --class=PostSeeder
```

## Step 5: add a route and a controller

```bash
php artisan make:controller PostController
```

`app/Http/Controllers/PostController.php`
```php
use 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']),
        ]);
    }
}
```

`routes/web.php`
```php
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:

`resources/js/pages/posts/Index.vue`
```vue
<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](https://laravel-vuejs.space/inertia-vue-document-title). The shell that stays mounted between those pages is the [persistent layout guide](https://laravel-vuejs.space/inertia-vue-persistent-layout).

## Step 7: test it

> **Write and run the first test**
>
> `tests/Feature/PostsTest.php`
> ```php
> 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)
>         );
> });
> ```
>
> ```bash
> php artisan test
> ```

## Register 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`.

```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

```shell
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.

```shell
composer require laravel/telescope --dev
php artisan telescope:install
php artisan migrate
```

The 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:

```ini
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](https://laravel-vuejs.space/laravel-vite-vue) 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 dev` runs everything you need locally.
- `make:model Post -mfs` gives you the migration, factory and seeder in one go.
- Controllers send props with `Inertia::render`; pages type them with `defineProps`.
- Routes and middleware live in `bootstrap/app.php`, not `Http/Kernel.php`.
- Format PHP with `vendor/bin/pint --dirty`, keep Telescope and `.env` off the remote, and commit `.env.example`.

## FAQ

**Q: 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.

**Q: 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.

**Q: How do I use PHPUnit instead of Pest?**

Pass `--phpunit` to `laravel new`. The installer does not ask about the testing framework.

**Q: 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.

**Q: 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.

**Q: 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`.

**Q: 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](https://laravel-vuejs.space/laravel-inertia-vue-crud).
- Upload a cover image in the [file upload guide](https://laravel-vuejs.space/laravel-vue-file-upload).
- Choose Inertia, a separate Vue SPA, or Nuxt in [which Laravel and Vue stack to use](https://laravel-vuejs.space/laravel-vue-in-2026).
- Run `npm run build` for production. The [deploy guide](https://laravel-vuejs.space/deploy-laravel-vue) covers the SSR build, the queue, and the `public/hot` file.

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](https://laravel.com/framework/docs/13.x/installation)
- [Laravel 13: Starter kits](https://laravel.com/framework/docs/13.x/starter-kits)
- [Inertia v3: Pages](https://inertiajs.com/docs/v3/the-basics/pages)
- [Inertia v3: Testing](https://inertiajs.com/docs/v3/advanced/testing)
- [Laravel Vue starter kit](https://github.com/laravel/vue-starter-kit)
- [Laravel docs: Routing](https://laravel.com/framework/docs/13.x/routing)
- [Laravel docs: Middleware](https://laravel.com/framework/docs/13.x/middleware)
- [Laravel 11 release notes: application structure](https://laravel.com/docs/11.x/releases#structure)
- [Laravel docs: Pint](https://laravel.com/framework/docs/13.x/pint)
- [laravel/pint on GitHub](https://github.com/laravel/pint)
- [Laravel docs: Telescope local only installation](https://laravel.com/framework/docs/13.x/telescope#local-only-installation)
- [Laravel docs: Telescope](https://laravel.com/framework/docs/13.x/telescope)
- [Laravel docs: Environment configuration](https://laravel.com/framework/docs/13.x/configuration#environment-configuration)
- [Vite docs: Env variables](https://vite.dev/guide/env-and-mode)
