# anji-plus/report architecture

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

- Interactive diagram: https://gitdiagram.com/anji-plus/report
- Repository: https://github.com/anji-plus/report

## Overview

##### Main Components
- Frontend (report-ui):
- A Vue.js-based single-page application.
- Uses libraries such as element-ui, vue-router, vue-echarts, vuedraggable, and luckysheet for interactive dashboards and data visualizations.
- Provides the graphical dashboard designer, login flow, and report viewing interfaces.
- Backend (report-core):
- A Spring Boot application built on Java 1.8 (with Maven dependency management via pom.xml).
- Implements business modules for data source integration, dataset management, report management, user access control (accessAuthority, accessRole, accessUser), dashboard widgets, datasets, file management, and more.
- Uses MyBatis-plus for database operations, Flyway for database migrations, and relies on external JDBC drivers (for MySQL, oracle, postgresql, etc.).
- Database and Data Sources:
- The system requires a MySQL database (with support for other data sources such as Elasticsearch, Kudu, etc. via custom drivers).
- Migration scripts (under report-core/src/main/resources/db/migration) are deployed automatically using Flyway.
- Deployment/Operations Scripts:
- Scripts in the build, deploy, and bin directories (e.g., start.sh, stop.sh) and Docker configurations help containerize and launch the system.
- Documentation and Configuration:
- The ‘doc’ directory holds the user guide and system documentation.
- Configuration files such as bootstrap.yml and pom.xml files neatly organize dependency and environment settings.

##### Relationships and Data Flow
- The frontend (report-ui) communicates with the backend (report-core) through API endpoints.
- The backend acts as a controller/service layer to process incoming requests, apply business logic (across multiple modules like access control, chart data retrieval, dataset transformation, etc.), and interface with databases.
- Data flows from configured data sources (via JDBC drivers and custom data connectors in report-core/lib) into the backend, and then is pushed to the frontend for rendering dashboards.
- External libraries (such as luckysheet and vue-echarts) in the frontend directly render interactive charts and spreadsheets.
- Docker and Maven build scripts indicate that the system is designed with containerized and automated environment deployment in mind.

##### Architectural Patterns and Design Principles
- MVC Pattern on the backend is visible through controller, service, and DAO layers (e.g., AccessUserController, AccessUserService, and AccessUserMapper).
- Modular design: The codebase is separated into modules (access authority, user, role, dashboard, dataset, etc.) for clear separation of concerns.
- Frontend uses component-based design (Vue components) with reusable custom components for elements like charts and forms.
- The project supports front-end/back-end separation, which makes it easier to scale the system or update either side independently.

##### Key Technologies and Frameworks to Highlight
- Backend Technologies:
- Java Spring Boot, MyBatis-plus, Flyway, Maven.
- External JDBC driver libraries (MySQL, Oracle, PostgreSQL, etc.) for database interactions.
- Frontend Technologies:
- Vue.js, vue-router, webpack, ES6.
- UI libraries (element-ui, avue, vue-echarts) and libraries for drag-and-drop (vuedraggable) and interactive spreadsheet (luckysheet).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer (Frontend)"
        FE["AJ-Report Frontend (Vue.js)"]:::frontend
    end

    %% Service Layer
    subgraph "Service Layer (Backend)"
        BE["AJ-Report Backend (Spring Boot + MyBatis-plus)"]:::backend
    end

    %% Database Layer
    subgraph "Database Layer"
        DB["Database (MySQL & Other Data Sources)"]:::database
        MIG["DB Migration Scripts (Flyway)"]:::migration
    end

    %% Deployment & Configuration
    subgraph "Deployment & Configuration"
        DOC1["Documentation: doc"]:::documentation
        DOC2["Documentation: doc/docs"]:::documentation
        DEP1["build.sh"]:::deployment
        DEP2["deploy.sh"]:::deployment
        DEP3["Dockerfile"]:::deployment
        DEP4["docker-compose.yml"]:::deployment
    end

    %% Relations between layers
    FE -->|"API_calls"| BE
    BE -->|"DB_operations"| DB
    MIG -->|"migrates"| DB

    %% Deployment scripts affecting Frontend and Backend
    DEP1 -->|"build"| FE
    DEP1 -->|"build"| BE
    DEP2 -->|"deploy"| FE
    DEP2 -->|"deploy"| BE
    DEP3 -->|"containerize"| BE
    DEP3 -->|"containerize"| DB
    DEP4 -->|"orchestrate"| BE
    DEP4 -->|"orchestrate"| DB

    %% Documentation supporting Frontend and Backend
    DOC1 ---|"guide"| FE
    DOC1 ---|"guide"| BE
    DOC2 ---|"guide"| FE
    DOC2 ---|"guide"| BE

    %% Click Events
    click FE "https://github.com/anji-plus/report/tree/master/report-ui"
    click BE "https://github.com/anji-plus/report/tree/master/report-core"
    click MIG "https://github.com/anji-plus/report/tree/master/report-core/src/main/resources/db/migration"
    click DOC1 "https://github.com/anji-plus/report/tree/master/doc"
    click DOC2 "https://github.com/anji-plus/report/tree/master/doc/docs"
    click DEP1 "https://github.com/anji-plus/report/blob/master/build.sh"
    click DEP2 "https://github.com/anji-plus/report/blob/master/deploy.sh"
    click DEP3 "https://github.com/anji-plus/report/tree/master/Dockerfile"
    click DEP4 "https://github.com/anji-plus/report/blob/master/docker-compose.yml"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#0000FF,stroke-width:2px;
    classDef backend fill:#90EE90,stroke:#008000,stroke-width:2px;
    classDef database fill:#FFDAB9,stroke:#FF8C00,stroke-width:2px;
    classDef deployment fill:#FFB6C1,stroke:#FF69B4,stroke-width:2px;
    classDef documentation fill:#E6E6FA,stroke:#9370DB,stroke-width:2px;
    classDef migration fill:#F0E68C,stroke:#BDB76B,stroke-width:2px;
```
