# somowhere/albedo architecture

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

- Interactive diagram: https://gitdiagram.com/somowhere/albedo
- Repository: https://github.com/somowhere/albedo

## Overview

The Albedo project is a full‐stack enterprise rapid development platform where a robust back end (built on Spring Boot, Spring Security, and Mybatis) provides a suite of common services and modular business functions, while a modern Vue/Element‑UI front end (albedo‑ui) acts as the presentation layer. The project is organized as a multi‑module Maven project, with clear separations between common libraries, feature modules, plugins, and server applications.

##### Main Components
- Common Library Layer:
– albedo‑common: Contains core utilities, logging (albedo‑common‑log), security (albedo‑common‑security), and module base classes (albedo‑common‑module). This layer provides the foundational functionalities used throughout the system.
– albedo‑dependencies: As a BOM manager for dependency versions.
- Business Modules:
– albedo‑modules: Implements feature domains. Examples include albedo‑appendix (attachments), albedo‑file (file API with multiple storage strategies), albedo‑gen (code generation), albedo‑monitor (system monitoring), albedo‑quartz (scheduling), albedo‑sys (RBAC and permission management), and albedo‑tenant (multi‑tenant support).
- Plugin Layer:
– albedo‑plugins: Provides extendable capabilities such as caching (albedo‑cache‑starter), database enhancements (albedo‑database), dynamic datasource (albedo‑dynamic‑datasource), Swagger API documentation (albedo‑swagger‑api), and UID generation (albedo‑uid).
- Server/Service Layer:
– albedo‑servers: Contains standalone runnable services:
- albedo‑admin: The admin service (typically running on port 4000) which handles backend administrative operations.
- albedo‑app: Provides the main API service for client applications.
- albedo‑quartz: A dedicated task scheduler that runs periodic jobs.
- Presentation Layer:
– albedo‑ui: The front‑end codebase (using Vue with Element‑UI) that interacts with the back‑end services and offers the user interface.

##### Relationships and Interactions
- The albedo‑ui (front‑end) sends HTTP requests (possibly RESTful calls) to the backend servers (especially albedo‑admin and albedo‑app) for user authentication, RBAC management, file management, code generation, scheduling, and monitoring.
- Each server component leverages the common libraries (albedo‑common) for cross‑cutting concerns such as security, logging, and configuration.
- The feature-specific modules (within albedo‑modules) encapsulate business logic and interact with the database and redis caching systems. They are architected to be plugged into the servers.
- The plugin layer provides additional infrastructure functionality (e.g., caching, dynamic datasource management) that is integrated within the business modules and servers.
- External resources such as the database (MySQL, Oracle) and Redis are integrated into the system, with configurations defined (for example, in the albedo‑admin’s and albedo‑app’s application.yml files).

##### Architectural Patterns and Design Principles
- Modular Design: The clear separation between common libraries, business modules, plugins, and servers demonstrates a highly modular architecture. Each module is responsible for a distinct business domain.
- Layered Architecture: The design follows presentation, business logic, service, and data layers.
- Dependency Injection and Cross‑cutting Concerns: Use of Spring Boot and Spring Security indicate a reliance on dependency injection, AOP (for logging and transaction management), and centralized exception handling.
- Extensibility via Plugins: The plugin modules allow for extending core functionality (for instance, integration with third‑party caching or database drivers).

##### Relevant Technologies and Frameworks
- Backend: Spring Boot 2.7.x, Spring Security, Mybatis (Mybatis Plus), Hutool.
- Build/Dependency Management: Maven multi‑module structure.
- Frontend: Vue.js, Element‑UI, with standard tools like webpack, ESLint, and testing frameworks (Jest).
- Infrastructure: MySQL or Oracle database, Redis for caching and session management, and Docker/Docker‑Compose for containerization and deployment.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        UI["albedo‑ui"]:::presentation
    end

    %% Server/Service Layer
    subgraph "Server/Service Layer"
        ADMIN["albedo‑admin"]:::server
        APP["albedo‑app"]:::server
        QUARTZ_SERVER["albedo‑quartz"]:::server
    end

    %% Core Functional Layers
    subgraph "Core Functional Layers"
        COMMON["albedo‑common"]:::common
        BOM["albedo‑dependencies"]:::common

        subgraph "Business Modules"
            APPENDIX["albedo‑appendix"]:::module
            FILE["albedo‑file"]:::module
            GEN["albedo‑gen"]:::module
            MONITOR["albedo‑monitor"]:::module
            QUARTZ_MOD["albedo‑quartz"]:::module
            SYS["albedo‑sys"]:::module
            TENANT["albedo‑tenant"]:::module
        end

        subgraph "Plugin Layer"
            CACHE["albedo‑plugin‑cache‑starter"]:::plugin
            DATABASE["albedo‑plugin‑database"]:::plugin
            DYNAMIC["albedo‑plugin‑dynamic‑datasource"]:::plugin
            SWAGGER["albedo‑plugin‑swagger"]:::plugin
            UID["albedo‑plugin‑uid"]:::plugin
            BIZ_IP["albedo‑plugin‑biz‑ip"]:::plugin
        end
    end

    %% External Systems
    subgraph "External Systems"
        DB["Database (MySQL/Oracle)"]:::external
        REDIS["Redis"]:::external
    end

    %% Connections from Presentation to Servers
    UI -->|"HTTPRequests"| ADMIN
    UI -->|"HTTPRequests"| APP

    %% Servers use Common Libraries and BOM
    ADMIN -->|"Uses"| COMMON
    APP -->|"Uses"| COMMON
    QUARTZ_SERVER -->|"Uses"| COMMON

    ADMIN -->|"Integrates"| BOM
    APP -->|"Integrates"| BOM
    QUARTZ_SERVER -->|"Integrates"| BOM

    %% Servers plug in Business Modules
    ADMIN -->|"PlugsIn"| APPENDIX
    ADMIN -->|"PlugsIn"| FILE
    ADMIN -->|"PlugsIn"| GEN
    ADMIN -->|"PlugsIn"| MONITOR
    ADMIN -->|"PlugsIn"| QUARTZ_MOD
    ADMIN -->|"PlugsIn"| SYS
    ADMIN -->|"PlugsIn"| TENANT

    APP -->|"PlugsIn"| APPENDIX
    APP -->|"PlugsIn"| FILE
    APP -->|"PlugsIn"| GEN
    APP -->|"PlugsIn"| MONITOR
    APP -->|"PlugsIn"| QUARTZ_MOD
    APP -->|"PlugsIn"| SYS
    APP -->|"PlugsIn"| TENANT

    %% Servers integrate Plugin Layer
    ADMIN -->|"Uses"| CACHE
    ADMIN -->|"Uses"| DATABASE
    ADMIN -->|"Uses"| DYNAMIC
    ADMIN -->|"Uses"| SWAGGER
    ADMIN -->|"Uses"| UID
    ADMIN -->|"Uses"| BIZ_IP

    APP -->|"Uses"| CACHE
    APP -->|"Uses"| DATABASE
    APP -->|"Uses"| DYNAMIC
    APP -->|"Uses"| SWAGGER
    APP -->|"Uses"| UID
    APP -->|"Uses"| BIZ_IP

    QUARTZ_SERVER -->|"Uses"| CACHE
    QUARTZ_SERVER -->|"Uses"| DATABASE
    QUARTZ_SERVER -->|"Uses"| DYNAMIC
    QUARTZ_SERVER -->|"Uses"| SWAGGER
    QUARTZ_SERVER -->|"Uses"| UID
    QUARTZ_SERVER -->|"Uses"| BIZ_IP

    %% Servers and Business Modules interact with External Systems
    ADMIN -->|"RW"| DB
    ADMIN -->|"RW"| REDIS
    APP -->|"RW"| DB
    APP -->|"RW"| REDIS
    QUARTZ_SERVER -->|"RW"| DB

    APPENDIX -->|"Interacts"| DB
    FILE -->|"Interacts"| DB
    GEN -->|"Interacts"| DB
    MONITOR -->|"Interacts"| DB
    QUARTZ_MOD -->|"Interacts"| DB
    SYS -->|"Interacts"| DB
    TENANT -->|"Interacts"| DB

    %% Click Events
    click UI "https://github.com/somowhere/albedo/tree/master/albedo-ui"
    click ADMIN "https://github.com/somowhere/albedo/tree/master/albedo-servers/albedo-admin-server"
    click APP "https://github.com/somowhere/albedo/tree/master/albedo-servers/albedo-app-server"
    click QUARTZ_SERVER "https://github.com/somowhere/albedo/tree/master/albedo-servers/albedo-quartz-server"
    click COMMON "https://github.com/somowhere/albedo/tree/master/albedo-common"
    click BOM "https://github.com/somowhere/albedo/blob/master/albedo-dependencies/pom.xml"
    click APPENDIX "https://github.com/somowhere/albedo/tree/master/albedo-modules/albedo-appendix"
    click FILE "https://github.com/somowhere/albedo/tree/master/albedo-modules/albedo-file"
    click GEN "https://github.com/somowhere/albedo/tree/master/albedo-modules/albedo-gen"
    click MONITOR "https://github.com/somowhere/albedo/tree/master/albedo-modules/albedo-monitor"
    click QUARTZ_MOD "https://github.com/somowhere/albedo/tree/master/albedo-modules/albedo-quartz"
    click SYS "https://github.com/somowhere/albedo/tree/master/albedo-modules/albedo-sys"
    click TENANT "https://github.com/somowhere/albedo/tree/master/albedo-modules/albedo-tenant"
    click CACHE "https://github.com/somowhere/albedo/tree/master/albedo-plugin/albedo-plugin-cache-starter"
    click DATABASE "https://github.com/somowhere/albedo/tree/master/albedo-plugin/albedo-plugin-database"
    click DYNAMIC "https://github.com/somowhere/albedo/tree/master/albedo-plugin/albedo-plugin-dynamic-datasource"
    click SWAGGER "https://github.com/somowhere/albedo/tree/master/albedo-plugin/albedo-plugin-swagger"
    click UID "https://github.com/somowhere/albedo/tree/master/albedo-plugin/albedo-plugin-uid"
    click BIZ_IP "https://github.com/somowhere/albedo/tree/master/albedo-plugin/albedo-plugin-biz-ip"

    %% Styles
    classDef presentation fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef server fill:#f8d7da,stroke:#721c24,stroke-width:2px;
    classDef common fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef module fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef plugin fill:#d1ecf1,stroke:#0c5460,stroke-width:2px;
    classDef external fill:#e2e3e5,stroke:#6c757d,stroke-width:2px;
```
