How to Install Inertia js in laravel 9

In this section, we will install Inertia JS in Laravel 9 . There are two simply way to install inertia using laravel breeze and jetstream package. In this tutorial we will see the both.


1) Install Inertia Using Laravel Breeze

Create Laravel Project

composer create-project --prefer-dist laravel/laravel inertia


Now, fill the details in env file.

.env

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=database_name
DB_USERNAME=database_user_name
DB_PASSWORD=database_password


Install Laravel breeze

Next, you need to run below command in your terminal

composer require laravel/breeze --dev

Setup Breeze With Inertia

You need to setup inertia js , run below command.

php artisan breeze:install vue
 
// Or...
 
php artisan breeze:install react
 
npm install
npm run dev
php artisan migrate


1) Install Inertia Using Jetstream

Create Laravel Project

composer create-project --prefer-dist laravel/laravel inertia


Now, fill the details in env.

.env

DB_CONNECTION=mysql
DB_HOST=127.0.0.1
DB_PORT=3306
DB_DATABASE=database_name
DB_USERNAME=database_user_name
DB_PASSWORD=database_password


Installing Jetstream

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

composer require laravel/jetstream


Install Jetstream With Inertia

php artisan jetstream:install inertia
// Or...
php artisan jetstream:install inertia --teams

After installing Jetstream, you should install and build your NPM dependencies and migrate your database:

npm install
npm run dev
php artisan migrate