# hyeonsangjeon/vertx-embedded-springboot architecture

> Architecture diagram of the GitHub repository hyeonsangjeon/vertx-embedded-springboot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/hyeonsangjeon/vertx-embedded-springboot
- Repository: https://github.com/hyeonsangjeon/vertx-embedded-springboot

## Overview

Key Components to Include:

##### Client Layer
- External clients making HTTP requests
- Port 8989 for Vert.x communication

##### Vert.x Layer
- Worker Verticles (VertxWorker.java) with a note showing 4 worker instances
- Event Loop with 6 instances
- SpringVerticleFactory for Vert.x-Spring integration

##### Spring Boot Layer
- Main Application component
- Spring Boot embedded server (port 9000)
- Actuator component (port 7979)

##### MVC Architecture Components
- Controllers/Handlers (RequestHandler, RouteHandler)
- Services (BookAsyncService, BookServiceImpl)
- Repositories (BookRepository)
- DAOs (BookDao)
- DTOs (Book)

##### Database Layer
- Both H2 and MariaDB options
- Liquibase migration component
- MyBatis integration

- [Client Layer]
- ↓
- [Vert.x Layer]
- ↓
- [Spring Boot Layer]
- ↓
- [MVC Components]
- ↓
- [Database Layer]

##### Connection Types
- Double lines: Data flow

##### Special Notations
- Async worker threads (4 instances)
- Event loop threads (6 instances)
- Port numbers (8989, 9000, 7979)
- Liquibase migration flow

Key Interactions to Highlight:

##### Request Flow
- Client → Vert.x Facade (8989) → Worker Verticles → Spring Services → Database

##### Database Migration Flow
- Liquibase → Database (on deployment)

##### Monitoring Flow
- External Monitor → Actuator (7979) → System Status

Additional Elements:

##### Configuration components
- DataSourceConfig
- Application properties
- Logging configurations

Keep the following aspects in mind:
- Asynchronous nature of the system
- Clear separation between Vert.x and Spring Boot components
- Scalability aspects (worker threads, event loops)
- Database migration and monitoring capabilities

## Diagram (Mermaid)

```mermaid
graph LR
    %% Client Layer
    subgraph CL["Client Layer"]
        Client[("External Clients")]
    end

    %% Vert.x Layer
    subgraph VL["Vert.x Layer"]
        VF["Vert.x Facade"]:::vertx
        SVF["Spring Verticle Factory"]:::vertx
        subgraph WP["Worker Pool (4 instances)"]
            direction LR
            W1["Worker 1"]:::vertx
            W2["Worker 2"]:::vertx
            W3["Worker 3"]:::vertx
            W4["Worker 4"]:::vertx
        end
        subgraph EL["Event Loop (6 instances)"]
            direction LR
            E1((Event 1)):::vertx
            E2((Event 2)):::vertx
            E3((Event 3)):::vertx
            E4((Event 4)):::vertx
            E5((Event 5)):::vertx
            E6((Event 6)):::vertx
        end
    end

    %% Spring Boot Layer
    subgraph SL["Spring Boot Layer"]
        direction LR
        RH["Route Handler"]:::spring
        RQH["Request Handler"]:::spring
        BS["Book Service"]:::spring
        BR["Book Repository"]:::spring
        AC["Actuator<br/>(Port 7979)"]:::spring
    end

    %% Data Layer
    subgraph DL["Data Layer"]
        direction LR
        DSC["DataSource Config"]:::data
        BD["Book DAO"]:::data
        MB["MyBatis Mapper"]:::data
        CP["Connection Pool"]:::data
    end

    %% Database Layer
    subgraph DBL["Database Layer"]
        direction LR
        DB[(Database<br/>H2/MariaDB)]:::db
        LB["Liquibase"]:::db
    end

    %% Connections
    Client -->|"REST API<br/>(Port 8989)"| VF
    VF --> SVF
    SVF --> WP
    WP --> RH
    RH --> RQH
    RQH --> BS
    BS --> BR
    BR --> BD
    BD --> MB
    MB --> CP
    CP --> DB
    LB -.->|"Migration"| DB

    %% Click Events
    click VF "https://github.com/hyeonsangjeon/vertx-embedded-springboot/blob/master/src/main/java/com/vertx/worker/vertx/VertxFacade.java"
    click SVF "https://github.com/hyeonsangjeon/vertx-embedded-springboot/blob/master/src/main/java/com/vertx/worker/vertx/factory/SpringVerticleFactory.java"
    click W1 "https://github.com/hyeonsangjeon/vertx-embedded-springboot/blob/master/src/main/java/com/vertx/worker/vertx/VertxWorker.java"
    click RH "https://github.com/hyeonsangjeon/vertx-embedded-springboot/blob/master/src/main/java/com/vertx/worker/mvc/handler/RouteHandler.java"
    click RQH "https://github.com/hyeonsangjeon/vertx-embedded-springboot/blob/master/src/main/java/com/vertx/worker/mvc/handler/RequestHandler.java"
    click BS "https://github.com/hyeonsangjeon/vertx-embedded-springboot/blob/master/src/main/java/com/vertx/worker/mvc/service/BookAsyncService.java"
    click BR "https://github.com/hyeonsangjeon/vertx-embedded-springboot/blob/master/src/main/java/com/vertx/worker/mvc/repository/BookRepository.java"
    click DSC "https://github.com/hyeonsangjeon/vertx-embedded-springboot/blob/master/src/main/java/com/vertx/worker/mvc/dao/config/DataSourceConfig.java"
    click BD "https://github.com/hyeonsangjeon/vertx-embedded-springboot/blob/master/src/main/java/com/vertx/worker/mvc/dao/BookDao.java"
    click MB "https://github.com/hyeonsangjeon/vertx-embedded-springboot/blob/master/src/main/resources/mappers/book/Book.xml"
    click LB "https://github.com/hyeonsangjeon/vertx-embedded-springboot/blob/master/src/main/resources/db/changelog/db.changelog-master.yaml"

    %% Styles
    classDef vertx fill:#3498db,stroke:#2980b9,color:white
    classDef spring fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#e74c3c,stroke:#c0392b,color:white
    classDef db fill:#f1c40f,stroke:#f39c12,color:black
    
    %% Legend
    subgraph Legend
        L1["Vert.x Component"]:::vertx
        L2["Spring Component"]:::spring
        L3["Data Layer"]:::data
        L4["Database Layer"]:::db
    end
```
