What is Laravel Jetstream?

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.

Jetstream is designed using Tailwind CSS and offers your choice of Livewire or Inertia scaffolding.

What is Livewire?

Laravel Livewire is a library that makes it simple to build modern, reactive, dynamic interfaces using Laravel Blade as your templating language. This is a great stack to choose if you want to build an application that is dynamic and reactive but don't feel comfortable jumping into a full JavaScript framework like Vue.js.

Learn more about Livewire from here: https://jetstream.laravel.com/2.x/stacks/livewire.html

What is Vuexy Jetstrap? Why do we need it?

Laravel Jetstream is designed using Tailwind CSS and offers your choice of Livewire or Inertia scaffolding. We have removed the Tailwind CSS dependency and modified the Livewire scaffolding as per our template.

Vuexy Jetstrap is a lightweight laravel 8 package that focuses on the VIEW side of Jetstream package installed in your Laravel application, so when a swap is performed, the Action, MODEL, CONTROLLER, Component and Action classes of your project is still 100% handled by Laravel development team with no added layer of complexity.

Please note we have not provided Inertia scaffolding yet. This package only works with livewire scaffolding.

Installation

Installing Jetstream

You may use Composer to install Jetstream into your new Laravel project:

      
composer require laravel/jetstream
      
    

After installing the Jetstream package, you may execute the jetstream:install Artisan command. In addition, you may use the --teams switch to enable team support. The jetstream:install command will also install a suite of "feature" tests that provide test coverage for the features provided by Jetstream.

Install Jetstream With Livewire
      
        // without teams support

        php artisan jetstream:install livewire

        or

        // with teams support

        php artisan jetstream:install livewire --teams
      
    
Install Vuexy Jetstrap

Use Composer to install Vuexy Jetstrap into your new Laravel project as dev dependency:

      
composer require pixinvent/jetstrap-vuexy --dev
      
    

Regardless how you install Jetstream, Jetstrap commands are very similar to that of Jetstream as it accepts the name of the stack you would like to swap (livewire).

It is important you install and configure Laravel Jetstream before performing a swap.

before beginning your Vuexy Jetstrap project. In addition, you may use the --teams switch to swap team assets just like you would in Jetstream:

      
        // without teams support

        php artisan jetstrap_vuexy:swap livewire

        or

        // with teams support

        php artisan jetstrap_vuexy:swap livewire --teams
      
    

This will publish overrides to enable Bootstrap like the good old days!

Finalizing The Installation

After installing Jetstrap and swapping Jetstream resources, remove tailwindCSS and its dependencies if any from your package.json and then install and build your NPM dependencies and migrate your database:

      
        yarn && yarn mix
      
    
Setup your database connection
      
DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=new_laravel_app
DB_USERNAME=root
DB_PASSWORD=
      
    
Run Migration
      
        php artisan migrate
      
    

Congratulation! you have successfully installed the jetstream in Vuexy Template.

How to enable and disabled Jetstream features?

Jetstream provides below listed features:

Under the hood, the authentication portions of Jetstream are powered by Laravel Fortify, which is a front-end agnostic authentication backend for Laravel.

We have two config files to enable or disable the Jetstream features in the config folder.

  • fortify.php
  • jetstream.php
fortify.php
        
    'features' => [
        Features::registration(),
        Features::resetPasswords(),
        // Features::emailVerification(),
        Features::updateProfileInformation(),
        Features::updatePasswords(),
        Features::twoFactorAuthentication([
            'confirmPassword' => true,
        ]),
    ],
        
      
jetstream.php
        
    'features' => [
        // Features::termsAndPrivacyPolicy(),
        // Features::profilePhotos(),
        // Features::api(),
        Features::teams(['invitations' => true]),
        Features::accountDeletion(),
    ],
        
      

You can comment or uncomment the listed features to enable or disable them.

Note: If you want to use profilePhotos() feature of jetstream then make sure to link your storage using the below artisan command and change your APP_URL as per your project URL in the .env file.

      
        php artisan storage:link
      
    
If you use Laravel password with Jetstream then you cannot use Jetstream's api() features.

Protecting Routes

Use middleware ['auth:sanctum', 'verified'] to protect your rotes.

    
  Route::group(['middleware' => 'auth:sanctum', 'verified'],function(){
    Route::get('/', [StaterkitController::class, 'home'])->name('home');
    .....
    ....
  });