This is a JWT-based Authentication System developed using React and Symfony with LexikJWTAuthenticationBundle. The system allows users to register, login, and retrieve user information. Users can also update their name and address. The code prioritizes security and maintains high code quality for production readiness and post-launch support.
These instructions will help you set up and run the project locally on your machine.
Before running the project, you need to have the following software installed:
- Docker: Download Docker
- Node.js: Download Node.js
- Composer: Download Composer
Follow these steps to get the project up and running:
Clone this repository to your local machine:
git clone <repository_url>
cd JWT-based-Authentication-System
-
Navigate to the
backend
folder:cd backend
-
Install the Symfony dependencies:
compose install
-
Set up the database and apply migrations:
php bin/console doctrine:database:create php bin/console doctrine:migrations:migrate
-
Configure the database connection in the
.env
file:DATABASE_URL=mysql://db_user:db_password@db/mysql
-
Generate the SSH keys for LexikJWTAuthenticationBundle:
mkdir -p config/jwt openssl genpkey -out config/jwt/private.pem -aes256 -algorithm rsa -pkeyopt rsa_keygen_bits:4096 openssl pkey -in config/jwt/private.pem -out config/jwt/public.pem -pubout
-
Enter a passphrase when generating the SSH keys, and update the
.env
file with the passphrase:JWT_PASSPHRASE=your_passphrase_here
-
Set the proper permissions for the SSH keys:
chmod 644 config/jwt/public.pem chmod 600 config/jwt/private.pem
-
Go back to the root folder of the project:
cd ..
-
Use
docker-compose
to start both the backend and frontend:docker-compose up -d
This command will build and start the containers. The -d flag runs the containers in detached mode.
-
Access the backend API: The Symfony backend API will be available at
http://localhost:8000/api
.
The project includes comprehensive unit tests for critical functionality. To run the tests, follow these steps:
For Backend Tests:
cd backend
php bin/phpunit
- React - A JavaScript library for building user interfaces.
- Symfony - A PHP web application framework.
- LexikJWTAuthenticationBundle - A JWT authentication bundle for Symfony.
- Docker - A platform for developing, shipping, and running applications in containers.
This project is licensed under the MIT License
- John Mahood - For the job description and company overview.
- Pascal Marechal - For providing the job interview test and guidance.
- The Coaches' Voice Company - For reviewing and evaluating the project.