# visualkhh/simple-boot architecture

> Architecture diagram of the GitHub repository visualkhh/simple-boot, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/visualkhh/simple-boot
- Repository: https://github.com/visualkhh/simple-boot

## Overview

##### Main System Components
- Core Module (“cores/simple”): This is the foundation of the framework. It includes the bootstrapping, dependency injection, AOP support (e.g., the “anno” and “aop” packages), configuration handling, transaction management, and proxy utilities. It’s essentially the core engine that supports the remaining modules.
- Database Modules (“dbs”):
– simple-db: The core interface for database access (via DatabaseAccessor) and transaction management.
– simple-db-h2: A specific implementation using H2, with starter and configuration classes.
– simple-db-hibernate: A Hibernate-based implementation that provides configuration, access management, and transaction management through its own classes.
- Web Modules (“webs”):
– simple-web: The basic web component that contains the core web server abstraction (using WebServer) and request/response management.
– simple-web-thymeleaf: A module that integrates a view resolver (likely using Thymeleaf) for templating.
– simple-web-netty: A module that leverages Netty for a non-blocking, reactive web server. It contains various packages for web communication, request dispatching, filtering, and exception handling.
- Example Project (“example”): Illustrates how to wire up the core, database, and web modules into a unified, running application. It shows sample controllers, services, and demonstrates using dependency injection and annotations for routing (e.g., @Controller, @Service, @GetMapping).

##### Relationships and Data Flow
- The core module is the backbone; every application built on simple-boot will invoke methods from this module during startup. It manages the dependency injection container, initializes beans (with annotations like @Injection, @PostConstruct), and configures core services (transaction management, configuration loading, proxying).
- The example project (and any application using this framework) depends on the following:
– It calls the core’s SimpleApplication to start.
– It uses the database modules by relying on the DatabaseAccessor and TransactionManager interfaces. Modules like simple-db-h2 and simple-db-hibernate listen to configuration and boot into the framework as beans.
– The web modules provide the web front end. For instance, controllers in the example use annotations from the core’s web packages to map requests to methods. The ViewResolver (in simple-web or simple-web-thymeleaf) is used to render responses.
– Dependency injection flows (e.g., from the framework’s container into controllers and services).
– Module dependencies where the core has an upward dependency (or a “bootstrapping” role) that initializes and wires in the database and web modules.

##### Architectural Patterns and Design Principles
- Modular Architecture: Each module (cores, dbs, webs) is separated clearly. This modular separation facilitates extension while keeping concerns isolated.
- Dependency Injection and Inversion of Control: Components such as controllers, services, and module starters are annotated to be automatically managed by the framework.
- Annotation-Driven Configuration: For instance, the use of annotations like @Controller, @Service, @Config, and @Transactional highlight the framework’s reliance on annotation processing for wiring functionalities.
- Aspect-Oriented Programming (AOP): With dedicated AOP packages and annotations (e.g., AopBefore, AopAfter), cross-cutting concerns can be managed neatly.

##### Final Recommendations for the Principal Software Engineer
– Data flow (for example, from Web controllers to Service layers, then to Database layers).
– Dependencies in terms of injection or initialization order.

## Diagram (Mermaid)

```mermaid
graph BT
    %% Top Layer: Example Application
    subgraph "Top Layer: Example Application"
        EX["Example Project\n(ExampleApplication, Controllers, Services)"]:::example
    end

    %% Middle Layer: Domain Modules
    subgraph "Middle Layer: Domain Modules"
        DB1["Simple-DB\n(DatabaseAccessor)"]:::db
        DB2["Simple-DB-H2\n(H2Starter, Config)"]:::db
        DB3["Simple-DB-Hibernate\n(HibernateStarter, Manager)"]:::db
        WEB1["Simple-Web\n(WebServer Abstraction)"]:::web
        WEB2["Simple-Web-Netty\n(NettyServer, HTTP Handlers)"]:::web
        WEB3["Simple-Web-Thymeleaf\n(ThymeleafViewResolver)"]:::web
    end

    %% Bottom Layer: Framework Infrastructure
    subgraph "Bottom Layer: Framework Infrastructure"
        CORE["Core Module\n(DI, AOP, Config, Transaction, Proxy)"]:::core
    end

    %% Relationships
    EX -->|"callsStartup"| CORE
    CORE -->|"configures"| DB1
    CORE -->|"configures"| DB2
    CORE -->|"configures"| DB3
    CORE -->|"configures"| WEB1
    CORE -->|"configures"| WEB2
    CORE -->|"configures"| WEB3
    DB1 -->|"injectedInto"| EX
    WEB1 -->|"injectedInto"| EX

    %% Click Events
    click CORE "https://github.com/visualkhh/simple-boot/tree/master/cores/simple"
    click DB1 "https://github.com/visualkhh/simple-boot/tree/master/dbs/simple-db"
    click DB2 "https://github.com/visualkhh/simple-boot/tree/master/dbs/simple-db-h2"
    click DB3 "https://github.com/visualkhh/simple-boot/tree/master/dbs/simple-db-hibernate"
    click WEB1 "https://github.com/visualkhh/simple-boot/tree/master/webs/simple-web"
    click WEB2 "https://github.com/visualkhh/simple-boot/tree/master/webs/simple-web-netty"
    click WEB3 "https://github.com/visualkhh/simple-boot/tree/master/webs/simple-web-thymeleaf"
    click EX "https://github.com/visualkhh/simple-boot/tree/master/example"

    %% Styles
    classDef core fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef db fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef web fill:#FFFF99,stroke:#000,stroke-width:1px;
    classDef example fill:#FFCC99,stroke:#000,stroke-width:1px;
```
