DEV Community

Cover image for How to setup Jetstream/Livewire in Laravel application
Stephen Akugbe
Stephen Akugbe

Posted on

How to setup Jetstream/Livewire in Laravel application

Laravel Jetstream is a beautifully designed application starter kit for Laravel and provides the perfect starting point for your next Laravel application. Jetstream provides the implementation for your application's login, registration, email verification, two-factor authentication, session management, API via Laravel Sanctum, and optional team management features (Copied from Jestream homepage). Laravel Jetstream

It is designed using Tailwind CSS and offers two option of stacks; Livewire/Blade and Inertia/Vue. For this tutorial, we will be setting up the Jetstream with Livewire.

Livewire is a full-stack framework for Laravel that makes building dynamic interfaces simple. With Livewire, you may pick and choose which portions of your application will be a Livewire component, while the other parts of your application can be rendered as traditional Blade templates. Great right! Especially for those used to creating Laravel applications with Blade templates.

To install Jetstream, run the following command in your Laravel application:

composer require laravel/jetstream
Enter fullscreen mode Exit fullscreen mode

Take note: Jetstream should only be installed into new Laravel applications. Attempting to install Jetstream into an existing Laravel application will result in unexpected behavior and issues

Now we will move on to installing Livewire with Jetstream:

php artisan jetstream:install livewire
Enter fullscreen mode Exit fullscreen mode

or
If you want to bootstrap the application to have teams, you can run the following command:

php artisan jetstream:install inertia --teams
Enter fullscreen mode Exit fullscreen mode

Once the installation is complete, you should install and buildnpm dependencies with the following commands:

npm install && npm run dev
Enter fullscreen mode Exit fullscreen mode

then run your migrations:

php artisan migrate
Enter fullscreen mode Exit fullscreen mode

You should then publish the Livewire stack's Blade components with the following command:

php artisan vendor:publish --tag=jetstream-views
Enter fullscreen mode Exit fullscreen mode

After all these steps, you can serve your application and you should be able to register, login and view a dashboard page once you login.

You can do more with Laravel jetstream, read more about it on the official Jestream docs

Top comments (0)