An open API service indexing awesome lists of open source software.

https://github.com/rockharshitmaurya/syllabus-v2

This system manages syllabus entries and tags through three microservices: Gateway, Syllabus-MSA, and Tag-V2. Get details about each microservice and their exciting features.
https://github.com/rockharshitmaurya/syllabus-v2

eureka-server feign-client jpa-hibernate junit microservices mokito redis spring-boot

Last synced: 27 days ago
JSON representation

This system manages syllabus entries and tags through three microservices: Gateway, Syllabus-MSA, and Tag-V2. Get details about each microservice and their exciting features.

Awesome Lists containing this project

README

          

# ๐Ÿš€ Syllabus-V2

## ๐ŸŒ Introduction
Welcome to the Syllabus-v2! This robust system efficiently manages syllabus entries and tags through three microservices: Gateway (Eureka Discovery Server), Syllabus-MSA, and Tag-V2. Dive into the comprehensive details about each microservice, dependencies, and the exciting features they offer.

### ๐Ÿ› ๏ธ Gateway Microservice
- **Purpose**: Eureka Discovery Server
- **Folder Structure**:
```
โ””โ”€โ”€ com
โ””โ”€โ”€ syllabus
โ””โ”€โ”€ gateway
โ””โ”€โ”€ EurekaServerApplication.java
```

### ๐Ÿ”ง Syllabus-MSA Microservice
- **Dependencies**:
- Spring Boot Starter Data JPA
- Spring Boot Starter Web
- Spring Boot Starter Test
- PostgreSQL
- Spring Boot Starter AOP
- Spring Boot Starter Validation
- Spring Cloud Starter Netflix Eureka Client
- Spring Boot Starter Data Redis
- Jedis
- Springdoc OpenAPI
- **Folder Structure**:
```
โ””โ”€โ”€ com
โ””โ”€โ”€ syllabus
โ””โ”€โ”€ api
โ”œโ”€โ”€ aspectLogger
โ”‚ โ”œโ”€โ”€ persistLog
โ”‚ โ”‚ โ”œโ”€โ”€ Logger.java
โ”‚ โ”‚ โ””โ”€โ”€ logs
โ”‚ โ”‚ โ”œโ”€โ”€ server_24_01_2024.log
โ”‚ โ”‚ โ”œโ”€โ”€ server_25_01_2024.log
โ”‚ โ”‚ โ””โ”€โ”€ server_30_01_2024.log
โ”‚ โ””โ”€โ”€ RequestLoggingAspect.java
โ”œโ”€โ”€ controller
โ”‚ โ””โ”€โ”€ SyllabusController.java
โ”œโ”€โ”€ dto
โ”‚ โ”œโ”€โ”€ request_dto
โ”‚ โ”‚ โ””โ”€โ”€ SyllabusDto.java
โ”‚ โ””โ”€โ”€ response_dto
โ”œโ”€โ”€ entity
โ”‚ โ””โ”€โ”€ Syllabus.java
โ”œโ”€โ”€ exception
โ”‚ โ””โ”€โ”€ GlobalExceptionHandler.java
โ”œโ”€โ”€ model
โ”‚ โ””โ”€โ”€ Message.java
โ”œโ”€โ”€ redis
โ”‚ โ””โ”€โ”€ RedisConfig.java
โ”œโ”€โ”€ service
โ”‚ โ”œโ”€โ”€ SyllabusServiceImpl.java
โ”‚ โ””โ”€โ”€ SyllabusService.java
โ”œโ”€โ”€ SyllabusMsaApplication.java
โ”œโ”€โ”€ test
โ””โ”€โ”€ validation
โ””โ”€โ”€ InputValidation.java
```
- **Endpoints**:
- `PUT` /syllabus-v2/updateSyllabus/{id}
- `POST` /syllabus-v2/createSyllabus
- `GET` /syllabus-v2
- `GET` /syllabus-v2/syllabus/getSyllabusById/{id}
- `GET` /syllabus-v2/syllabus/exists/{id}
- `GET` /syllabus-v2/getAllSyllabus
- `DELETE` /syllabus-v2/deleteSyllabus/{id}
- **Features**:
- Swagger for API documentation
- FeignClient for external service calls
- Aspect-Oriented Programming (AOP) for logging
- Redis for caching
- Logging with log files
- Spring Actuator for monitoring

### ๐Ÿท๏ธ Tag-V2 Microservice
- **Dependencies**:
- Spring Boot Starter Data JPA
- Spring Boot Starter Web
- Spring Boot Starter Test
- PostgreSQL
- Spring Boot Starter AOP
- Spring Boot Starter Validation
- Lombok
- Spring Cloud Starter Netflix Eureka Client
- Spring Cloud Starter OpenFeign
- Springdoc OpenAPI
- **Folder Structure**:
```
โ””โ”€โ”€ com
โ””โ”€โ”€ syllabus
โ””โ”€โ”€ tagv2
โ”œโ”€โ”€ aspectLogger
โ”‚ โ”œโ”€โ”€ persistLog
โ”‚ โ”‚ โ”œโ”€โ”€ Logger.java
โ”‚ โ”‚ โ””โ”€โ”€ logs
โ”‚ โ”‚ โ”œโ”€โ”€ server_24_01_2024.log
โ”‚ โ”‚ โ”œโ”€โ”€ server_25_01_2024.log
โ”‚ โ”‚ โ””โ”€โ”€ server_30_01_2024.log
โ”‚ โ””โ”€โ”€ RequestLoggingAspect.java
โ”œโ”€โ”€ controller
โ”‚ โ”œโ”€โ”€ TagController.java
โ”‚ โ””โ”€โ”€ TagRelationController.java
โ”œโ”€โ”€ dto
โ”‚ โ”œโ”€โ”€ request_dto
โ”‚ โ”‚ โ”œโ”€โ”€ TagDto.java
โ”‚ โ”‚ โ””โ”€โ”€ TagRelationDto.java
โ”‚ โ””โ”€โ”€ response_dto
โ”‚ โ”œโ”€โ”€ SyllabusWithTagsResponseDTO.java
โ”‚ โ””โ”€โ”€ TagResponseDTO.java
โ”œโ”€โ”€ entity
โ”‚ โ”œโ”€โ”€ SyllabusTag.java
โ”‚ โ””โ”€โ”€ Tag.java
โ”œโ”€โ”€ feign
โ”‚ โ””โ”€โ”€ SyllabusInterface.java
โ”œโ”€โ”€ model
โ”‚ โ””โ”€โ”€ Message.java
โ”œโ”€โ”€ repository
โ”‚ โ””โ”€โ”€ TagRepository.java
โ”œโ”€โ”€ service
โ”‚ โ”œโ”€โ”€ ManageTagRelationImpl.java
โ”‚ โ”œโ”€โ”€ ManageTagRelation.java
โ”‚ โ”œโ”€โ”€ TagServiceCrudImpl.java
โ”‚ โ””โ”€โ”€ TagServiceCrud.java
โ””โ”€โ”€ TagV2Application.java
```
- **Endpoints**:
- Tag-Controller:
- `PUT` /syllabus-v2/tag/update/{tagId}
- `POST` /syllabus-v2/tag/add
- `GET` /syllabus-v2/tag
- `GET` /syllabus-v2/tag/{tagId}
- `GET` /syllabus-v2/tag/all
- `DELETE` /syllabus-v2/tag/delete/{tagId}
- Tag-Relation-Controller:
- `POST` /syllabus-v2/tag/manage/detach-tag
- `POST` /syllabus-v2/tag/manage/attach-tag
- `GET` /syllabus-v2/tag/manage/getSyllabusWithTags

## ๐Ÿ› ๏ธ Installation

### 1. Clone the Repository
- Open a terminal or command prompt.
- Run the following command:
```bash
git clone https://github.com/rockharshitmaurya/syllabus-v2
```

### 2. Build and Run the Gateway Microservice
- Navigate to the `gateway` folder.
- Run the following commands:
```bash
cd gateway
./mvnw clean install
./mvnw spring-boot:run
```
The Eureka Discovery Server should start successfully.

### 3. Build and Run the Syllabus-MSA Microservice
- Navigate to the `syllabus-msa` folder.
- Run the following commands:
```bash
cd syllabus-msa
./mvnw clean install
./mvnw spring-boot:run
```
Ensure that the necessary dependencies are resolved, and the Syllabus microservice is up and running.

### 4. Build and Run the Tag-V2 Microservice
- Navigate to the `tag-v2` folder.
- Run the following commands:
```bash
cd tag-v2
./mvnw clean install
./mvnw spring-boot:

run
```
Verify that the Tag microservice starts without any issues.
```

### 5. Access the System
- Once all microservices are up and running, access the following URLs:
- Gateway Eureka Dashboard: [http://localhost:8083/](http://localhost:8083/)
- API Documentation (Syllabus-MSA): [http://localhost:8081/swagger-ui.html](http://localhost:8080/swagger-ui.html)
- Documentation (Tag-V2): [http://localhost:8082/swagger-ui.html](http://localhost:8081/swagger-ui.html)

## ๐Ÿงช Unit Testing with Mockito

- Extensive unit testing has been performed using JUnit and Mockito in the Syllabus-MSA microservice.
- Test coverage has achieved 100% for service classe.
- Below is an example of the unit test coverage report, displaying the percentage of coverage for each class:

![Unit Test Coverage](https://github.com/rockharshitmaurya/syllabus-v2/assets/46915044/7fc8fba3-3e21-48d6-815d-b8ccbe31eaa3)

Apologies for the oversight. Let's include information about the implemented features and unit testing using Mockito in the README:

## Implemented Features

### 1. Swagger
- Swagger has been integrated into both the Syllabus-MSA and Tag-V2 microservices for easy API documentation.
- Explore the APIs using Swagger UI:
- Syllabus-MSA: [http://localhost:8081/swagger-ui.html](http://localhost:8081/swagger-ui.html)
- Tag-V2: [http://localhost:8082/swagger-ui.html](http://localhost:8082/swagger-ui.html)

### 2. FeignClient Call
- The Syllabus-MSA microservice incorporates FeignClient for making external service calls.

### 3. AOP (Aspect-Oriented Programming)
- Logging aspects have been implemented using AOP to provide detailed logs for better system understanding and debugging.
- Log files are organized by date for easier tracking:
- Example Log Folder: `/com/syllabus/api/aspectLogger/persistLog/logs`

### 4. Redis
- Redis has been integrated into the Syllabus-MSA microservice for caching purposes.

### 5. Logging
- Logging is implemented throughout the Syllabus-MSA microservice, and log files are generated for each day.
- Example Log Folder: `/com/syllabus/api/aspectLogger/persistLog/logs`

### 6. Actuator
- Spring Boot Actuator is incorporated for monitoring the microservices. You can access actuator endpoints to check the health, metrics, and more.
- Example Actuator Endpoints:
- [http://localhost:8081/actuator/health](http://localhost:8081/actuator/health) (Syllabus-MSA)
- [http://localhost:8082/actuator/health](http://localhost:8082/actuator/health) (Tag-V2)