# duartejules/microservice-projet architecture

> Architecture diagram of the GitHub repository duartejules/microservice-projet, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/duartejules/microservice-projet
- Repository: https://github.com/duartejules/microservice-projet

## Overview

##### Project Type Analysis
This is a microservices architecture project consisting of four main microservices:
- Product Service (Java/Spring Boot)
- Order Service (Node.js)
- Review Service (Python)
- User Manager Service (Node.js)

A. Main Components to Include:

##### Client Layer
- Dashboard (Entry point at localhost/dashboard/)
- Swagger UI interfaces

##### API Gateway Layer
- Routing to different microservices (evident from the localhost endpoints)

##### Microservices Layer
- Product Microservice (Java/Spring Boot)
- Order Microservice (Node.js)
- Review Microservice (Python)
- User Manager Microservice (Node.js)

##### Database Layer
- MongoDB instances (indicated by MONGO_URI environment variables)

##### Authentication Layer
- JWT Authentication service (indicated by JWT_SECRET in user service)

B. Component Relationships:

- Client → API Gateway
- API Gateway → Individual Microservices
- Microservices → MongoDB
- User Manager MS → JWT Auth
- Inter-service communications (if any)

##### Specific Design Elements

Use the following visual elements:
- Blue for Java (Product Service)
- Green for Node.js (Order and User Services)
- Yellow for Python (Review Service)
- Double lines for data persistence operations

##### Architecture Details to Highlight

For each microservice, show internal structure:

Product Service (Java):
- Controller
- Service
- Repository
- Model (Product)

Order Service (Node.js):
- Controllers
- Models
- Routes

Review Service (Python):
- Controllers
- Models
- Routes

User Manager Service (Node.js):
- Controllers
- Middlewares (Auth)
- Models (User, Order)
- Routes

##### Additional Elements

Include:
- Docker container boundaries
- Load balancing indicators (if applicable)
- Security layers
- Service discovery mechanism

##### Database Layer

Left to right organization:
- Related services together
- Clear separation of concerns

##### Notes

Annotations for:
- Port numbers
- Environment variables
- Docker compose relationships
- Authentication flows
- Database connections

## Diagram (Mermaid)

```mermaid
graph TB
    %% Client Layer
    subgraph CL[Client Layer]
        Dashboard["Dashboard UI"]
        SwaggerUI["Swagger UI"]
    end

    %% API Gateway Layer
    APIGateway[("API Gateway")]

    %% Authentication Layer
    JWTAuth["JWT Authentication"]:::auth

    %% Microservices Layer
    subgraph MS[Microservices]
        subgraph PS[Product Service]
            PController["Product Controller"]:::java
            PService["Product Service"]:::java
            PRepository["Product Repository"]:::java
            PModel["Product Model"]:::java
        end

        subgraph OS[Order Service]
            OController["Order Controller"]:::nodejs
            OModel["Order Model"]:::nodejs
            ORoutes["Order Routes"]:::nodejs
        end

        subgraph RS[Review Service]
            RController["Review Controller"]:::python
            RModel["Review Model"]:::python
            RRoutes["Review Routes"]:::python
            RDBConfig["Database Config"]:::python
        end

        subgraph US[User Manager Service]
            UController["User Controller"]:::nodejs
            UAuth["Auth Middleware"]:::nodejs
            UModel["User Model"]:::nodejs
            UOrderModel["Order Model"]:::nodejs
            URoutes["Order Routes"]:::nodejs
            ULogin["Login"]:::nodejs
            URegister["Register"]:::nodejs
            UProfile["Profile"]:::nodejs
        end
    end

    %% Database Layer
    subgraph DB[Database Layer]
        MongoDB1[(MongoDB)]
        MongoDB2[(MongoDB)]
        MongoDB3[(MongoDB)]
        MongoDB4[(MongoDB)]
    end

    %% Relationships
    Dashboard --> APIGateway
    SwaggerUI --> APIGateway
    APIGateway --> PS
    APIGateway --> OS
    APIGateway --> RS
    APIGateway --> US
    
    %% Product Service Internal
    PController --> PService
    PService --> PRepository
    PRepository --> PModel
    PModel --> MongoDB1
    
    %% Order Service Internal
    OController --> ORoutes
    ORoutes --> OModel
    OModel --> MongoDB2
    
    %% Review Service Internal
    RController --> RRoutes
    RRoutes --> RModel
    RModel --> RDBConfig
    RDBConfig --> MongoDB3
    
    %% User Service Internal
    UController --> URoutes
    URoutes --> UModel
    UModel --> MongoDB4
    UAuth --> JWTAuth
    ULogin --> UAuth
    URegister --> UAuth
    UProfile --> UAuth

    %% Click Events
    click PController "https://github.com/DuarteJules/Microservice-projet/blob/main/microservice_product/src/main/java/com/moudjane/microservice_product/controller/ProductController.java"
    click PService "https://github.com/DuarteJules/Microservice-projet/blob/main/microservice_product/src/main/java/com/moudjane/microservice_product/service/ProductService.java"
    click PRepository "https://github.com/DuarteJules/Microservice-projet/blob/main/microservice_product/src/main/java/com/moudjane/microservice_product/repository/ProductRepository.java"
    click PModel "https://github.com/DuarteJules/Microservice-projet/blob/main/microservice_product/src/main/java/com/moudjane/microservice_product/model/Product.java"
    
    click OController "https://github.com/DuarteJules/Microservice-projet/blob/main/microservice_order/controllers/order.js"
    click OModel "https://github.com/DuarteJules/Microservice-projet/blob/main/microservice_order/models/order.js"
    click ORoutes "https://github.com/DuarteJules/Microservice-projet/blob/main/microservice_order/routes/order.routes.js"
    
    click RController "https://github.com/DuarteJules/Microservice-projet/blob/main/review-python/controllers/review_controller.py"
    click RModel "https://github.com/DuarteJules/Microservice-projet/blob/main/review-python/models/review_model.py"
    click RRoutes "https://github.com/DuarteJules/Microservice-projet/blob/main/review-python/routes/review_routes.py"
    click RDBConfig "https://github.com/DuarteJules/Microservice-projet/blob/main/review-python/database.py"
    
    click UController "https://github.com/DuarteJules/Microservice-projet/blob/main/usermanagerms/controllers/userController.js"
    click UAuth "https://github.com/DuarteJules/Microservice-projet/blob/main/usermanagerms/middlewares/auth.js"
    click UModel "https://github.com/DuarteJules/Microservice-projet/blob/main/usermanagerms/models/User.js"
    click UOrderModel "https://github.com/DuarteJules/Microservice-projet/blob/main/usermanagerms/models/Order.js"
    click URoutes "https://github.com/DuarteJules/Microservice-projet/blob/main/usermanagerms/routes/orderRoutes.js"
    click ULogin "https://github.com/DuarteJules/Microservice-projet/blob/main/usermanagerms/users/login.js"
    click URegister "https://github.com/DuarteJules/Microservice-projet/blob/main/usermanagerms/users/register.js"
    click UProfile "https://github.com/DuarteJules/Microservice-projet/blob/main/usermanagerms/users/profile.js"

    %% Styles
    classDef java fill:#b3e0ff,stroke:#333,stroke-width:2px
    classDef nodejs fill:#b3ffb3,stroke:#333,stroke-width:2px
    classDef python fill:#fff2b3,stroke:#333,stroke-width:2px
    classDef auth fill:#ffb3b3,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        Java["Java Service"]:::java
        Node["Node.js Service"]:::nodejs
        Python["Python Service"]:::python
        Auth["Auth Component"]:::auth
    end
```
