Laravel Jetstream is an application scaffolding system for Laravel that provides a more robust starting point for modern web applications compared to Laravel Breeze. While Breeze is minimalistic, Jetstream offers additional features like team management, API tokens, and two-factor authentication. It’s a great starting point if you’re building complex applications with more advanced requirements.
Key Features of Laravel Jetstream:
- Authentication: Provides registration, login, password reset, email verification, and session management functionality.
- Two-Factor Authentication (2FA): Supports two-factor authentication for increased security using services like Google Authenticator.
- Team Management: Includes team-based functionality, allowing users to manage multiple teams, team invitations, and switching between teams.
- Profile Management: Includes user profile and password management features.
- API Tokens: Provides API token management using Laravel Sanctum for building APIs with personal access tokens.
- Email Verification: Built-in email verification with routes and controllers.
- Frontend Options: Offers either Inertia.js (with Vue.js or React) or Livewire (with Blade templates) for frontend interactivity.
- Session Management: Users can manage and logout active sessions across multiple devices.
Installation
To install Laravel Jetstream, follow these steps:
- Install Laravel: If you haven’t already installed Laravel, create a new project:
1composer create-project --prefer-dist laravel/laravel my-app
- Require Laravel Jetstream: Navigate to your project directory and install Jetstream:1composer require laravel/jetstream
- Install Jetstream: Run the installation command, choosing either Livewire or Inertia.js (with Vue.js or React). Here’s how to install Jetstream with each:
- For Livewire:1php artisan jetstream:install livewire
- For Inertia.js with Vue.js:
1php artisan jetstream:install inertia - For Inertia.js with React: You can manually add React after installing Inertia.js.
- For Livewire:
- Optional: Install Teams Feature: If you want to enable the team management feature, include the
--teams
flag:- For Livewire with teams:
1php artisan jetstream:install livewire --teams - For Inertia.js with teams:
1php artisan jetstream:install inertia --teams
- For Livewire with teams:
- Run Migrations: Jetstream includes migrations for authentication, teams, and API tokens. Run them using:
1php artisan migrate - Install NPM Dependencies: Install the necessary frontend dependencies and compile them:
12npm installnpm run dev - Serve the Application: Finally, start your Laravel development server:
1php artisan serve
Additional Features:
- Two-Factor Authentication: Jetstream comes with two-factor authentication, which you can enable via the user profile screen.
- Teams: If you’ve enabled the team feature, users can create and manage teams, invite members, and assign roles.
- API Tokens: With Laravel Sanctum, Jetstream allows users to generate API tokens for external applications or mobile apps.
Jetstream vs Breeze:
- Breeze: A simpler and more lightweight starter kit for projects that don’t need advanced features.
- Jetstream: Offers more comprehensive functionality, ideal for larger, more feature-rich applications with things like team support, API tokens, and two-factor authentication.