Laravel Jetstream with inertiajs on MAMP

How to setup Laravel Jetstream with Inertiajs on localhost (MAMP)

How to setup Laravel Jetstream with Inertia.js on MAMP localhost

Getting setup with Laravel Jetstream and Inertiajs is a simple process and can be done in 5 minutes. All code for this tutorial can be found below the video.

1. Install Laravel

The first thing you need to do is install Laravel. In the terminal go to the folder where you want to install your Laravel Jetstream project. Run the following command, replacing ‘business_tool’ with the name you want to give your project:


composer create-project laravel/laravel business_tool

Let the installation run, it may take a minute or so depending on the speed of your internet.

2. Install Jetstream

Now we have Laravel installed, we need to install Jetstream. Navigate to the Laravel project you just created in the terminal (replace ‘business_tool’ with the name of your project):


cd business_tool

Then run the following command:


composer require laravel/jetstream

Again, let the installation happen, it might take a while.

3. Install Inertia.js

Run the following command to install Inertia.js:


php artisan jetstream:install inertia

Now run:


npm install

Let it install then run:


npm run build

Let the build happen. We are nearly there!

4. Create a database in MAMP

Now we need to create a database in MAMP so that we can use our new Laravel Jetstream installation on our localhost. Open the MAMP WebStart page and navigate to “phpMyAdmin”

phpMyAdmin
How to find phpMyAdmin in MAMP WebStart page

Now give your database a name and click create:

Create database
Create database in phpMyAdmin

5. Edit your .env file

We now need to edit the .env file in your project. Go ahead and open up the file. Find where the database configurations are and enter the following (remember to replace “business_tool” with the name of the database you just created). Add “DB_SOCKET” and make it equal to the the socket displayed on the MAMP WebStart page under MySQL.


DB_DATABASE=business_tool
DB_USERNAME=root
DB_PASSWORD=root
DB_SOCKET=/Applications/MAMP/tmp/mysql/mysql.sock

6. Run the migration command

We now need to run the migration artisan command:


php artisan migrate

Your database should now be up and running. We just have a couple more commands to run and we will be setup with Laravel Jetstream and inertiajs!

Last commands to complete the setup of Laravel Jetstream with Inertiajs

We now need to run a couple of commands to get our Jetstream app going:


php artisan serve

Now open another terminal window. This is important because the previous command and the next command need to be running simultaneously . In the new terminal window run:


npm run dev

You’re good to go!

Now you are all set up! Head over to localhost:8000 and you should see your Laravel Jetstream app with inertiajs all setup!

Laravel Jetstream App
Laravel Jetstream App using Inertiajs
John

I have videos too!

If you found this post helpful, please consider subscribing to the @codingoblin YouTube channel 😀

Want updates when I release something interesting?

Sign up for my newsletter to stay up to date.