A Fullstack Project with Laravel and React Menu Hierarchy
This README will guide you through setting up and running the project locally, as well as how it has made use of use of Docker and CircleCI.
This project is a fullstack application with:
- Laravel as the backend framework.
- React for the frontend.
You can run the project in two main ways:
-
Install Dependencies:
-
Backend (Laravel):
- Ensure you have Composer installed.
- Clone the repository:
git clone https://github.com/your-repository.git cd your-repository
- Copy the example environment file and generate a new
.env
file:cp .env.example .env
- Install PHP dependencies:
composer install
- Generate an application key:
php artisan key:generate
-
Frontend (React):
- Navigate to the React folder:
cd react
- Install Node.js dependencies:
npm install
- Navigate to the React folder:
-
-
Run the Backend:
- In the root folder of the project, start the Laravel development server:
php artisan serve
- In the root folder of the project, start the Laravel development server:
-
Run the Frontend:
- Open a new terminal window or tab, navigate to the React folder, and start the React development server:
npm run dev
The frontend will be available at
http://localhost:3000
by default. - Open a new terminal window or tab, navigate to the React folder, and start the React development server:
-
Build and Start Docker Containers:
- In the root folder of the project, build and start the Docker containers:
docker-compose up --build
This command will build the Docker images and start the containers for both the backend and the frontend.
- In the root folder of the project, build and start the Docker containers:
-
Access the Application:
- Once the containers are up and running, you can access the application at
http://localhost
for the frontend and the backend API should be available within the Docker network.
- Once the containers are up and running, you can access the application at
The project uses CircleCI for continuous integration and continuous deployment. The pipeline is configured to deploy the application to an AWS EC2 instance.
Here's a structured section for your README.md on CircleCI configuration:
CircleCI is used for continuous integration and deployment in this project. The configuration ensures that the code is tested and deployed automatically, maintaining the quality and up-to-date state of the application.
-
Configuration File:
.circleci/config.yml
The
.circleci/config.yml
file contains the CircleCI pipeline configuration. This file defines the various jobs and workflows that CircleCI will execute to build, test, and deploy the application.
- Unit Tests:
- The CircleCI pipeline runs automated tests to ensure the integrity of the application. For example, it executes
MenuItemTest
in the Laravel backend to verify that menu items function as expected. - The testing job is defined in the
config.yml
file and typically involves installing dependencies, running tests, and reporting results.
- The CircleCI pipeline runs automated tests to ensure the integrity of the application. For example, it executes
- Automatic Deployment:
- Upon successful completion of the tests, CircleCI automatically deploys the application to the AWS EC2 instance.
- The deployment process is managed through deployment jobs defined in the
config.yml
file. This may involve SSH access to the EC2 instance, copying files, and restarting services.
You can access the application at the following IP address:
- Login Page: http://16.171.230.177/login