Laravel Jetstream is the official Laravel starter kit designed for developers who want more than just basic authentication. It provides a robust foundation with features like two-factor authentication, API tokens, teams, and profile management. Jetstream is ideal for building modern applications that require advanced user management out of the box.
What Is Laravel Jetstream?
Jetstream builds on Laravel Fortify by providing not just backend services, but also fully styled front-end scaffolding. It supports both Livewire + Blade and Inertia + Vue/React, giving developers flexibility to choose between a traditional or modern SPA-like experience.
- Authentication (login, registration, password reset, email verification)
- Two-factor authentication (2FA)
- Profile photo and account management
- API support with Laravel Sanctum
- Team and multi-user support
(see comparison of Laravel Starter Kits)
Installing Jetstream
composer require laravel/jetstream
php artisan jetstream:install livewire
# or
php artisan jetstream:install inertia
npm install && npm run dev
php artisan migrateCode language: PHP (php)
These commands install Jetstream, scaffold the chosen front-end stack (Livewire or Inertia), compile assets, and prepare database migrations for advanced user features like teams and two-factor authentication.
Protecting Routes
// routes/web.php
Route::middleware(['auth:sanctum', 'verified'])
->get('/dashboard', function () {
return view('dashboard');
})
->name('dashboard');Code language: PHP (php)
This ensures only authenticated and email-verified users can access the dashboard. Jetstream uses Sanctum for API authentication, making it secure for SPA and mobile integrations.
Controller Example with Teams
// app/Http/Controllers/ProjectController.php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class ProjectController extends Controller
{
public function __construct()
{
$this->middleware(['auth', 'verified']);
}
public function index()
{
// Example: Only allow projects from the current team
$projects = auth()->user()->currentTeam->projects;
return view('projects.index', compact('projects'));
}
}Code language: PHP (php)
This controller applies middleware for authentication and verification. Inside the index method, it fetches projects only for the logged-in user’s current team — showcasing Jetstream’s built-in team support.
Blade Example: Team Switcher
<!-- resources/views/navigation-menu.blade.php -->
<div class="mt-3 space-y-1">
@foreach (Auth::user()->allTeams() as $team)
<x-jet-switchable-team :team="$team" />
@endforeach
</div>Code language: HTML, XML (xml)
This Blade snippet renders a team switcher in the navigation menu. Users can seamlessly switch between multiple teams, a feature built directly into Jetstream.
Inertia + Vue Example
// resources/js/Pages/Dashboard.vue
<template>
<div>
<h1 class="text-2xl font-bold">Welcome, {{ $page.props.auth.user.name }}</h1>
<p class="mt-2">You are part of team: {{ $page.props.auth.user.current_team.name }}</p>
<Link href="/logout" method="post" as="button" class="mt-4 px-4 py-2 bg-red-500 text-white rounded">
Logout
</Link>
</div>
</template>
<script setup>
import { Link } from '@inertiajs/vue3'
</script>Code language: HTML, XML (xml)
This Inertia + Vue component shows the logged-in user’s name and current team. The $page.props.auth.user object comes directly from Jetstream’s authentication layer. The Link component handles logout via POST request, keeping the SPA flow seamless without a full page reload.
Comparison: Jetstream vs Breeze vs Fortify
| Feature | Breeze | Jetstream | Fortify |
|---|---|---|---|
| Purpose | Minimal starter kit with basic auth | Advanced starter kit with teams, API, and 2FA | Backend-only auth services |
| Front-end | Blade + Tailwind (Inertia optional) | Livewire + Blade or Inertia + Vue/React | None (UI must be built manually) |
| Teams | No | Yes | No |
| 2FA | No | Yes | Yes (backend only) |
| Best Use Case | Small/medium apps, MVPs | SaaS apps, team-based apps | Custom UI projects |
Laravel Jetstream goes far beyond basic authentication. It equips your Laravel app with modern, production-ready features like two-factor authentication, API tokens, and team management. If you’re building SaaS applications or team-based platforms, Jetstream is the ideal choice compared to Breeze (minimal) or Fortify (backend-only).
0 Comments