Laravel Jetstream: Quick Review
The official team from Laravel has announced the next major version, Laravel 8.0, to release on the 8th of September 2020.
Along with this significant release, few first-party packages, including Laravel Jetstream, Fortify are also releasing to join the Laravel ecosystem.
The author of Laravel initially announced Laravel Jetstream at Laracon Online 2020 with a complete walk-through featuring the new goodies for Laravel 8.
The packages releasing will also be the next free and open-source packages by the Laravel team.
What is Jetstream?
Laravel Jetstream is a brand new application scaffolding package, which comes with some convenient features, and gives a perfect start point for your next Laravel 8 project.
In short, Jetstream includes features like login, registration, email verification, 2FA, session management, API support, and teams support.
The past versions of Laravel stood with the Bootstrap framework for a long time. As of now, with the extensive popularity of Tailwind CSS, Jetstream is also designed using Tailwind CSS, which is a utility-first CSS framework.
Jetstream offers two different flavors to choose between Livewire, Inertia, which allows developers to use their preferred ones.
$ php artisan jetstream:install livewire // or $ php artisan jetstream:install inertia
For teams feature, add --teams option on the artisan command.
$ php artisan jetstream:install livewire --teams
Once you install your Jetstream stack, remember to compile your frontend assets using the command below.
npm install && npm run dev
Through, Laravel Installer
The team has recently released the v4 version of the Laravel installer to support Jetstream's installation via the installer. Make sure you upgrade your composer package if you have it already installed.
$ laravel new your-next-project-name --jet
You will be able to see this beautifully designed dashboard view once you set it up correctly.
Jetstream comes with a profile edit feature for the user, and the forms fields are necessary standard fields, including profile photo for the user registration, so you are always free to customize those files for your use case.
Jetstream brings features like change password, enable 2FA, revoke authenticated browser sessions under the account. These are the regular features that most do not need customization. However, if you would like to modify, you could change the relevant code in action classes under the
Jetstream out of the box comes with an email verification feature. If you decide to enable this feature, once a user registers for your project, they will be taken to a screen to click the verification link sent to their email used during the registration.
To enable this feature, scroll to features array within the
fortify.php config file, as you have full control to edit the file.
Jetstream introduces an action panel that allows the user to delete their account entirely. You have full control over the code to customize for the backend logic under
Jetstream comes with first-party integration with Laravel Sanctum for API support. If you wonder how the Laravel Sanctum works, follow the official docs for full information.
Inside Jetstream, with Sanctum's use, each user can generate multiple API tokens for their account.
These tokens are used in API call to authorize the access to the application via the API call.
You must enable this feature as well under the
jetstream.php config file.
'features' => [ Feature::api(), ],
Jetstream packs a great feature as teams, as many people are going to use it in their next project. It gives a great way to manage a team, create a team, switch between the team, even manage roles, permission to the member, etc.
The team feature also needs to be enabled via the
jetstream.php config file.
'features' => [ Feature::teams(), ],
To read in-depth about the teams feature, and use case and customization, follow the official documentation.
While using any of the two choices from Livewire or Inertia, you can still utilize many packed features with your entire application.
Those features include components, models, forms, validation helpers. If your application context matches to use them, you are free to take them and never write your own again. To publish those files, use the below command.
$ php artisan vendor:publish --tag=jetstream-views
In the Laracon Online talk, Taylor mentioned, Laravel team has almost offered the non-billing part of Laravel Spark as Laravel Jetstream, which is entirely free for everyone now.
Thanks for staying up to the end of the article. If you think it is worth reading, share this article in your circle and follow me on Twitter for more updates.