I have a developer group on Facebook with over 9000 developers.
It was time to create a website for this group.
There were a couple of options, but I decided to use Laravel as a backend and Next.js as a front-end.
Mohamed Said published a beneficial video on Laravel's youtube channel.
He is one of the smartest developers in the Laravel community.
This time, I followed Mohamed's approach, and as my son, Alim says: "It was easy peasy lemon squeezy."
I will share my experience, and hope it will help you too.
Laravel Installation
$ mkdir ~/projects/devaz
$ git clone https://github.com/themsaid/ergodnc.git
$ npm i
$ composer i
$ php artisan key:generate
$ php artisan migrate
$ php artisan db:seed
$ php artisan serve
$ Copy .env file and configure db settings:
DB_DATABASE=devaz
DB_USERNAME=root
DB_PASSWORD=
$ Add these lines to .env file
SANCTUM_STATEFUL_DOMAINS=app.devaz.test
SESSION_DOMAIN=.devaz.test
$ php artisan optimize:clear
NextJS Installation
$ git clone https://github.com/themsaid/ergodnc-nextjs
$ npm i
$ Change baseURL to 'http://api.devaz.test', on lib/axios.js
$ npm run dev
Laravel Valet
$ composer global require laravel/valet
$ echo $PATH
$ export PATH=$PATH:~/.composer/vendor/bin
$ valet install //It will ask password, write your comp password.
$ cd "laravel folder"
$ valet link api.devaz
$ cd "next folder"
$ valet proxy app.devaz http://127.0.0.1:3000
$ Then you can see
laravel app on http://api.devaz.test
next app on http://app.devaz.test