I've set this project up as a mono repo (meaning there are multiple projects in the repo).
This project contains:
- A React app set up as an SPA located in the
react-spa
directory. - A Laravel api located in the
backend-api
directory
Clone this repo:
git clone https://github.com/QuentinWatt/questions-react-spa-and-laravel-api-example-app.git ~/react-spa-and-laravel-api
Move to the React directory
cd ~/react-spa-and-laravel-api/react-spa
Install the project dependencies with Yarn (or NPM)
yarn
Run the project in development mode
yarn start
This will require basic laravel hosting environment is set up on your computer with Laravel Valet, Laravel Homestead or alternative.
Move to the laravel directory
cd ~/react-spa-and-laravel-api/backend-api
Install the PHP dependencies
composer install
Generate the app keys
php artisan key:generate
Copy the .env.example
file to .env
cp .env.example .env
Dont forget to set up your environment variables.
Run the database migrations
php artisan migrate
Seed up some example (Optional)
php artisan db:seed