In this article, I want to outline as simply as possible the differences between four first-party Laravel packages – UI, Jetstream, Fortify and Breeze. All, to some extent, help you scaffold your apps (or parts of them) so you can get on with the good stuff.
Prior to this package's existence, authentication was generated in Laravel with the artisan auth:make
command. If you've worked with Laravel for a while, you'll remember this command.
The functionality that auth:make
provided was removed and put into a separate package called laravel/ui
. This meant you'd have to use Composer to pull this package in, and then issue the registered artisan commands to generate authentication scaffolding.
For a long time, this was the only officially supported scaffold for Laravel. If you didn't use this package, you'd have to build authentication, password resets and other features yourself. This package also gives a choice between using Vue or React and comes with Bootstrap and the required markup by default.
Although considered legacy, you can still use it today!
Use this package if:
Laravel Jetstream, released alongside Laravel 8, made a massive leap from the laravel/ui
package and included a completely different scaffolding experience. At the time of writing, it includes presets for either Laravel Livewire or Inertia.js and removes Bootstrap in favour of Tailwind.
Jetstream also provides more features than laravel/ui
out of the box, including profile information updating, two-factor authentication and support for teams.
Under the hood, Jetstream uses Fortify (discussed later) to drive the authentication functionality. By scaffolding an app with Jetstream, you're also pulling in Fortify, so you can use any of the features this provides now, or into the future.
Jetstream operates very differently from laravel/ui
by hiding away a lot of the underlying functionality (mainly because it uses Fortify), favouring Actions
that allow you to modify what happens when, for example, users register or delete their account. Some of these actions are provided by Fortify, some are actions specifically built for Jetstream.
Jetstream makes heavy use of Blade components to create reusable UI elements like form inputs. Because of this, if you're not familiar with Blade components or want to start heavily customising the UI quickly, you'll have to spend some time re-creating components from scratch with your own styles. This is both a positive and negative, because componentizing common UI elements is a great practice, but with a pre-built solution comes the cost of having ready-built components that you may need to change.
Tailwind is included by default in Jetstream, which is a utility-based CSS framework, although this can be swapped out for another framework or nothing at all. However, you'd have to rebuild all of Jetstream's components because they all use Tailwind styles.
Finally, Jetstream uses Alpine.js, which is a minimal JavaScript framework.
Use Jetstream if:
If you think Jetstream might be for you, take a look at the Laravel Jetstream course and Laravel Jetstream Teams course to get up to speed!
Laravel Fortify is a frontend agnostic authentication implementation. This means it doesn't care how you implement the styling or frontend functionality of the features it provides.
Laravel Jetstream (discussed earlier) uses Fortify under the hood to provide features like authentication, recovering passwords, two factor authentication and updating user's profile information.
You can use Fortify on it's own without Jetstream! If you need all of the features that Fortify provides, but want to start the rest of your app (including the frontend) from scratch, Fortify is a great option.
Fortify works by registering all of the controllers you need for actions like registering, logging in and enabling two-factor authentication. All you need to do is tell Fortify what view to render, post the data through and Fortify takes care of the rest. After you've installed Fortify, you'll find an Actions
directory published that allows you to modify what happens when actions like registration take place.
Use Fortify if:
If Fortify sounds like what you need, check out the Authentication with Laravel Fortify course, which covers implementing all of Fortify's features.
Laravel Breeze is the latest scaffold package released, offering a more up-to-date version of laravel/ui
. It provides the same authentication functionality as laravel/ui
, but uses Tailwind instead of Bootstrap, and does not include presets for Vue or React.
Although Breeze uses Tailwind, it's much easier to swap this out for something else compared to Jetstream.
Breeze does not use Fortify under the hood, but instead publishes controllers to your app so they're easier to modify (like the laravel/ui
package).
Breeze does still use Blade components where applicable, so if you decide to use Breeze, make sure to read up on these, or swap the Blade components out with something else.
Use Breeze if:
laravel/ui
.Whatever you're building, you'll find a package from this selection that suits you. Sure, there's a learning curve, but you'll spend a lot less time building features you expect by default, and more time on the actual workings of your app.