# mehmetnuri/quarkus-reactive-mongodb-example architecture

> Architecture diagram of the GitHub repository mehmetnuri/quarkus-reactive-mongodb-example, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mehmetnuri/quarkus-reactive-mongodb-example
- Repository: https://github.com/mehmetnuri/quarkus-reactive-mongodb-example

## Overview

##### Detailed Component Breakdown

a. Client Layer:
- External HTTP clients making REST calls
- API endpoints grouped by functionality

b. Application Layer (Core):
- REST Resources Layer (UserResource)
- Service Layer (UserService)
- Repository Layer (UserRepository)
- Entity/DTO Layer (User/UserDTO)

Supporting Components:
- Mapper Component (UserMapper using MapStruct)
- Error Handling Component (GlobalExceptionHandler)
- Common Utilities (PaginationUtils)

c. Data Layer:
- MongoDB Database
- Collections (Users)

##### Flow Representation

**Client → UserResource → UserService → UserRepository → MongoDB**

##### Technical Details

- Quarkus 3.12.3
- Java 21
- MongoDB 4.4
- Hibernate Reactive 1.0
- RestEasy Reactive 2.0
- MapStruct 1.4.2.Final

##### Cross-Cutting Concerns

Horizontal layers for:
- Error Handling
- DTO Mapping
- Pagination

##### Specific Implementation Details

- Pagination structure
- Error response format
- DTO structure
- Entity structure

##### Container Information

A section showing:
- Docker container configuration
- Application properties
- Environment configurations

##### Reactive Nature
- Reactive streams and non-blocking operations
- Async boundaries

##### Data Flow
- Request/Response cycle
- Error propagation
- DTO/Entity transformation

##### Scalability Aspects
- MongoDB connection pooling
- Reactive endpoints
- Docker containerization

Keep the following in mind:

- Use standardized UML notation where applicable
- Notes for important architectural decisions
- Version numbers for major components
- Extension points for future development

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Style Definitions
    classDef client fill:#f9f,stroke:#333,stroke-width:2px
    classDef api fill:#2196F3,stroke:#333,color:white
    classDef service fill:#4CAF50,stroke:#333,color:white
    classDef repository fill:#FFC107,stroke:#333
    classDef database fill:#9C27B0,stroke:#333,color:white
    classDef error fill:#f44336,stroke:#333,color:white
    classDef utility fill:#FF9800,stroke:#333
    classDef entity fill:#607D8B,stroke:#333,color:white
    classDef config fill:#795548,stroke:#333,color:white

    %% Client Layer
    subgraph ClientLayer["Client Layer"]
        Client["HTTP Clients"]:::client
    end

    %% Application Layer
    subgraph AppLayer["Application Layer (Quarkus 3.12.3)"]
        %% REST Layer
        subgraph RestLayer["REST Resources Layer"]
            UserResource["UserResource"]:::api
        end

        %% Service Layer
        subgraph ServiceLayer["Service Layer"]
            UserService["UserService"]:::service
        end

        %% Repository Layer
        subgraph RepoLayer["Repository Layer"]
            UserRepo["UserRepository"]:::repository
        end

        %% Entity/DTO Layer
        subgraph DataLayer["Entity/DTO Layer"]
            User["User Entity"]:::entity
            UserDTO["UserDTO"]:::entity
        end

        %% Cross-cutting Components
        subgraph CrossCutting["Cross-cutting Concerns"]
            UserMapper["UserMapper"]:::utility
            ExceptionHandler["GlobalExceptionHandler"]:::error
            PaginationUtils["PaginationUtils"]:::utility
            ErrorResponse["ErrorResponse"]:::error
            PageResult["PageResult"]:::utility
        end
    end

    %% Data Layer
    subgraph DBLayer["Data Layer"]
        MongoDB[(MongoDB 4.4)]:::database
    end

    %% Technical Specs
    subgraph TechSpecs["Technical Specifications"]
        Config["Docker & App Config"]:::config
    end

    %% Relationships
    Client --> |HTTP Requests| UserResource
    UserResource --> |Reactive Stream| UserService
    UserService --> |Reactive Query| UserRepo
    UserRepo --> |Reactive Operations| MongoDB
    UserService --> UserMapper
    UserMapper --> User
    UserMapper --> UserDTO
    UserResource --> ExceptionHandler
    UserService --> PaginationUtils
    PaginationUtils --> PageResult
    ExceptionHandler --> ErrorResponse

    %% Click Events
    click UserResource "https://github.com/MehmetNuri/quarkus-reactive-mongodb-example/blob/master/src/main/java/com/mehmetnuri/resource/UserResource.java"
    click UserService "https://github.com/MehmetNuri/quarkus-reactive-mongodb-example/blob/master/src/main/java/com/mehmetnuri/service/UserService.java"
    click UserRepo "https://github.com/MehmetNuri/quarkus-reactive-mongodb-example/blob/master/src/main/java/com/mehmetnuri/repository/UserRepository.java"
    click User "https://github.com/MehmetNuri/quarkus-reactive-mongodb-example/blob/master/src/main/java/com/mehmetnuri/entity/User.java"
    click UserDTO "https://github.com/MehmetNuri/quarkus-reactive-mongodb-example/blob/master/src/main/java/com/mehmetnuri/dto/UserDTO.java"
    click UserMapper "https://github.com/MehmetNuri/quarkus-reactive-mongodb-example/blob/master/src/main/java/com/mehmetnuri/mapper/UserMapper.java"
    click ExceptionHandler "https://github.com/MehmetNuri/quarkus-reactive-mongodb-example/blob/master/src/main/java/com/mehmetnuri/exception/GlobalExceptionHandler.java"
    click ErrorResponse "https://github.com/MehmetNuri/quarkus-reactive-mongodb-example/blob/master/src/main/java/com/mehmetnuri/common/ErrorResponse.java"
    click PaginationUtils "https://github.com/MehmetNuri/quarkus-reactive-mongodb-example/blob/master/src/main/java/com/mehmetnuri/utils/PaginationUtils.java"
    click PageResult "https://github.com/MehmetNuri/quarkus-reactive-mongodb-example/blob/master/src/main/java/com/mehmetnuri/common/PageResult.java"
    click Config "https://github.com/MehmetNuri/quarkus-reactive-mongodb-example/tree/master/src/main/docker/"

    %% Legend
    subgraph Legend["Legend"]
        L1["REST API"]:::api
        L2["Service"]:::service
        L3["Repository"]:::repository
        L4["Database"]:::database
        L5["Error Handling"]:::error
        L6["Utility"]:::utility
        L7["Entity/DTO"]:::entity
        L8["Configuration"]:::config
    end
```
