# lakernote/easy-admin architecture

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

- Interactive diagram: https://gitdiagram.com/lakernote/easy-admin
- Repository: https://github.com/lakernote/easy-admin

## Overview

##### Main Components
- Frontend Application: Located under the “web/admin” directory. It contains HTML files, CSS, JavaScript, and various static assets. This part handles the user interface (login pages, system views, charts, etc.) and interacts with the backend via REST APIs.
- Backend Service: The bulk of the Java source is stored in “src/main/java/com/laker/admin”. This includes multiple modules (e.g., “sys”, “ext”, “task”, “chat”, “flow”) and configurations. The backend is built as a Spring Boot application and uses a modular package structure. Key subcomponents include:
- Core application entry (EasyAdminApplication.java)
- Configuration classes (Spring configurations, thread pool, JWT or cache config, web MVC configuration, etc.)
- Feature modules (user management, department management, code generation, workflow, logging, task scheduling)
- AOP components (for metrics, rate limiting, trace, repeated submission prevention)
- Data access layers using Mybatis‑Plus (mappers and XML mapper files in “resources/mapper”)
- Database: The “sql” folder contains MySQL initialization scripts (e.g., easy-admin.sql) that set up the schema.
- Workflow Engine: Integration of Snakerflow (workflow related files/resources).
- Monitoring & API Documentation: Knife4j configuration and actuator endpoints, plus Javamelody integration for application monitoring.
- Auxiliary Components: Utility features such as locking (Redis and JDBC implementations), caching (Redis and in-memory), file storage (Local and Aliyun implementations), and code generation (CodeGenerator.java as an entry point for code generation).
- Deployment & DevOps: Dockerfile, docker-compose.yml, Jenkinsfile, assembly scripts (packaging into a ZIP), and Maven configuration (pom.xml) indicate how the app is built and deployed.

##### Relationships and Interactions
- The Frontend interacts with the Backend through REST APIs. Depending on the deployment mode, the web assets may be served directly from the Spring Boot jar or through a separate web server (like Nginx).
- The Backend processes business logic (such as authentication using sa‑token, permission control using RBAC, workflow management with Snakerflow, and data permissions via Mybatis‑Plus interceptors).
- AOP is used broadly in the backend to provide cross-cutting concerns (rate limiting, logging, tracing).
- The Database (MySQL) is accessed via Mybatis‑Plus; read and write operations flow from the backend service.
- External libraries (e.g., hutool for utilities, Knife4j for API docs) are integrated into the service layer.
- Deployment components (Docker, Jenkins pipelines) handle build, package, and deploy operations.

##### Architectural Patterns and Design Principles
- Modular Design: The project is broken into distinct modules (sys, ext, task, flow, chat) each addressing a specific function in the admin system.
- MVC Pattern: The backend uses Controllers (within modules like sys/controller) to handle HTTP requests, Service layers for business logic, and Mappers for data access.
- Separation of Concerns: With a clear separation between configuration, core framework logic (AOP, caching, locking), and feature modules.
- AOP for Cross-Cutting Concerns: Rate limiting, logging/tracing, and request validation are implemented as aspects.
- Flexible Deployment: The project supports single-package “fat jar” deployment as well as containerized deployment using Docker.

##### Technologies, Frameworks, or Libraries
- Spring Boot for the overall framework.
- Mybatis‑Plus for ORM and data access.
- Druid for database connection pooling.
- Knife4j for API documentation.
- sa‑token for authentication and authorization.
- Javamelody for monitoring.
- Snakerflow as the workflow engine.
- LayUI (plus Pear‑Admin and related front-end components) for the user interface.
- Maven for project management/build system.
- Docker and Jenkins for deployment and CI/CD.

##### Extra Details
- That the backend is built using Spring Boot running on an embedded Tomcat server.
- Optionally denote the use of AOP aspects (like RateLimitAspect, TraceAspect) in a distinct notation (such as annotations or side labels on the backend block).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        F1("Client (Browser)"):::frontendRect
        F2("Frontend Static Resources (LayUI)"):::frontendRect
    end

    %% Backend Application
    subgraph "Backend Application"
        B1("Core Application Entry (EasyAdminApplication)"):::backendRect
        B2("Configuration Classes"):::backendRect
        B3("Sys Module"):::backendRect
        B4("Ext Module"):::backendRect
        B5("Task Module"):::backendRect
        B6("Chat Module"):::backendRect
        B7("Flow Module"):::backendRect
        B8("AOP Components"):::backendRect
        B9("Data Access (XML Mappers)"):::backendRect
        B10("Workflow Engine (Java Integration)"):::backendRect
        B11("Workflow Engine Resources"):::backendRect
    end

    %% External Services & Tools
    subgraph "External Services & Tools"
        E1("API Documentation (Knife4j)"):::externalRect
        E2("Monitoring (Javamelody)"):::externalRect
        E3("Caching"):::externalRect
        E4("Locking"):::externalRect
        E5("Code Generation"):::externalRect
    end

    %% Database
    subgraph "Database"
        D1(["MySQL Database"]):::databaseCyl
    end

    %% Deployment & DevOps
    subgraph "Deployment & DevOps"
        Dep1("Dockerfile"):::deploymentRect
        Dep2("docker-compose.yml"):::deploymentRect
        Dep3("Jenkins Pipeline"):::deploymentRect
        Dep4("Assembly Scripts"):::deploymentRect
        Dep5("Maven Build (pom.xml)"):::deploymentRect
    end

    %% Database Initialization Scripts
    subgraph "Database Initialization"
        DB1("SQL Scripts"):::deploymentRect
    end

    %% Connections
    F1 -->|"LoadsUI"| F2
    F1 -->|"RESTAPICall"| B1

    %% Backend internal routing
    B1 -->|"Uses"| B2
    B1 -->|"RoutesTo"| B3
    B1 -->|"RoutesTo"| B4
    B1 -->|"RoutesTo"| B5
    B1 -->|"RoutesTo"| B6
    B1 -->|"RoutesTo"| B7
    B1 -->|"AppliesAOP"| B8
    B8 -->|"Intercepts"| B3
    B8 -->|"Intercepts"| B4
    B8 -->|"Intercepts"| B5
    B8 -->|"Intercepts"| B6
    B8 -->|"Intercepts"| B7
    B3 -->|"DataOps"| B9
    B4 -->|"DataOps"| B9
    B5 -->|"DataOps"| B9
    B6 -->|"DataOps"| B9
    B7 -->|"Workflow"| B10
    B7 -->|"WorkflowRes"| B11

    %% Data access to database
    B9 -->|"Query/Update"| D1

    %% Backend invoking external services
    B1 -->|"DocsAPI"| E1
    B1 -->|"Monitor"| E2
    B1 -->|"CacheAccess"| E3
    B1 -->|"LockMechanism"| E4

    %% Auxiliary components connection
    B1 -->|"Triggers"| E5

    %% Deployment connections (illustrative)
    B1 -->|"Build/Deploy"| Dep1
    Dep1 --> Dep2
    Dep2 --> Dep3
    Dep3 --> Dep4
    Dep4 --> Dep5

    %% Database scripts connection
    D1 ---|"Initialize"| DB1

    %% Click Events
    click F2 "https://github.com/lakernote/easy-admin/tree/master/web/admin"
    click B1 "https://github.com/lakernote/easy-admin/blob/master/src/main/java/com/laker/admin/EasyAdminApplication.java"
    click B2 "https://github.com/lakernote/easy-admin/tree/master/src/main/java/com/laker/admin/config"
    click B3 "https://github.com/lakernote/easy-admin/tree/master/src/main/java/com/laker/admin/module/sys"
    click B4 "https://github.com/lakernote/easy-admin/tree/master/src/main/java/com/laker/admin/module/ext"
    click B5 "https://github.com/lakernote/easy-admin/tree/master/src/main/java/com/laker/admin/module/task"
    click B6 "https://github.com/lakernote/easy-admin/tree/master/src/main/java/com/laker/admin/module/chat"
    click B7 "https://github.com/lakernote/easy-admin/tree/master/src/main/java/com/laker/admin/module/flow"
    click B8 "https://github.com/lakernote/easy-admin/tree/master/src/main/java/com/laker/admin/framework/aop"
    click B9 "https://github.com/lakernote/easy-admin/tree/master/src/main/resources/mapper"
    click B10 "https://github.com/lakernote/easy-admin/tree/master/src/main/java/com/laker/admin/module/flow"
    click B11 "https://github.com/lakernote/easy-admin/tree/master/src/main/resources/flows"
    click E1 "https://github.com/lakernote/easy-admin/blob/master/src/main/java/com/laker/admin/config/Knife4jConfig.java"
    click E2 "https://github.com/lakernote/easy-admin/tree/master/src/main/java/com/laker/admin/framework/ext/actuator"
    click E3 "https://github.com/lakernote/easy-admin/tree/master/src/main/java/com/laker/admin/framework/cache"
    click E4 "https://github.com/lakernote/easy-admin/tree/master/src/main/java/com/laker/admin/framework/lock"
    click E5 "https://github.com/lakernote/easy-admin/blob/master/src/test/java/com/laker/admin/CodeGenerator.java"
    click Dep1 "https://github.com/lakernote/easy-admin/tree/master/Dockerfile"
    click Dep2 "https://github.com/lakernote/easy-admin/blob/master/docker-compose.yml"
    click Dep3 "https://github.com/lakernote/easy-admin/tree/master/Jenkinsfile"
    click Dep4 "https://github.com/lakernote/easy-admin/tree/master/assembly"
    click Dep5 "https://github.com/lakernote/easy-admin/blob/master/pom.xml"
    click DB1 "https://github.com/lakernote/easy-admin/tree/master/sql"

    %% Style Definitions
    classDef frontendRect fill:#ADD8E6,stroke:#000,stroke-width:2px;
    classDef backendRect fill:#90EE90,stroke:#000,stroke-width:2px;
    classDef externalRect fill:#FFCCCB,stroke:#000,stroke-width:2px;
    classDef deploymentRect fill:#Fefbd8,stroke:#000,stroke-width:2px;
    classDef databaseCyl fill:#Fddaac,stroke:#000,stroke-width:2px,stroke-dasharray: 5 5;
```
