This is a basic example of an authentication application with a backend built in Laravel and a frontend in React.js. The app demonstrates user login functionality and includes a test user for demonstration purposes.
This app requires Docker to work, make sure you have docker installed in your system.
Follow these steps to set up and run the application on your local machine:
Use Docker to install dependencies via Laravel Sail:
docker run --rm \
-u "$(id -u):$(id -g)" \
-v $(pwd):/var/www/html \
-w /var/www/html \
laravelsail/php83-composer:latest \
composer install --ignore-platform-reqs
Start the backend containers using Laravel Sail in detached mode:
./vendor/bin/sail up -d
Run the migrations to set up the database schema. Note that you may encounter a Connection refused
error if the Sail containers are not fully ready. If this happens, wait a few seconds and retry the command.
./vendor/bin/sail art migrate
Seed the database with a test user:
./vendor/bin/sail art db:seed
Install the required frontend dependencies and compile assets:
npm i
npm run dev
Open http://localhost in your browser. You should see the login form. Use the following test credentials to log in:
- Email:
[email protected]
- Password:
password
After successful login, you will be redirected to a page showing the user's email and name. 🎉