Laravel 8 Auth with Inertia JS Jetstream Tutorial

In this tutorial you will learn about the Laravel 8 Auth with Inertia JS Jetstream Tutorial and its application with practical example.

In this Laravel 8 Auth with Inertia JS and Jetstream Tutorial will show how to create user authentication system using Inertia JS and Jetstream in laravel 8. In this tutorial you will learn to create user authentication in laravel using Inertia JS and Jetstream package. We will create login, register, logout, forget password, profile and reset password page using laravel Inertia JS and Jetstream authentication scaffolding without using laravel 8 make:auth command. Jetstream auth with Inertia JS package that enable us to generate default laravel authentication scaffolding. Laravel Inertia JS and Jetstream auth includes fully functional login, register, logout, reset password, forget password, email verification, two-factor authentication, session management.

Laravel 8 Auth with Inertia JS Jetstream Tutorial

In this  article, you will learn to create Authentication using Inertia JS and Jetstream. In this step by step tutorial you will understand Laravel 8 Authentication using Inertia JS and Jetstream:

Step 1: Install Laravel 8

First of all we need to create a fresh laravel project, download and install Laravel 8 using the below command

Setup Database Credentials

Now, lets create a MySQL database and connect it with laravel application. After creating database we need to set database credential in application’s .env file.

Step 2: Create Auth with Jetstream Inertia JS

In this step, we will install Jetstream Package via the composer dependency manager. Use the following command to install Jetstream.

Now, install jetstream inertia authentication to create authentication using bellow command.

Install node js package:

Now, run package:

Now, run following command to migrate database schema.

Step 3: Create Migration and Model

Now, in this step we will create migration file. Please run the following command:

Migration:

Then create Post model by using following command:

App/Models/Post.php

Step 4: Create Route

After this, we need to define routes in “routes/web.php” file. Lets open “routes/web.php” file and add the following routes in it.

routes/web.php

Step 5: Create Controller

Now, lets create a controller named PostController using command given below –

app/Http/Controllers/PostController.php

Step 6: Share Inertia Variables

In this step we will share ‘message’ and ‘errors’ variable for success message and validation error. Lets share this variables on appservices provider as following:

app/Providers/AppServiceProvider.php

Step 7: Create Vue Page

Now, create posts page vue file to list posts and create and update. so, let’s create it and add bellow code on it.

resources/js/Pages/posts.vue

Run npm watch command below.

Run Development Server

Now we are ready to run our example so lets start the development server using following artisan command –

Now, open the following URL in browser to see the output –

In this tutorial we have learn about the Laravel 8 Auth with Inertia JS Jetstream Tutorial and its application with practical example. I hope you will like this tutorial.