# yangzongzhuan/ruoyi-vue architecture

> Architecture diagram of the GitHub repository yangzongzhuan/ruoyi-vue, 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/yangzongzhuan/ruoyi-vue
- Repository: https://github.com/yangzongzhuan/ruoyi-vue

## Overview

##### Main Components
- Frontend Component: Represented by the ruoyi-ui module. This layer is built using Vue and Element UI. It handles user interactions, routing, and visualization.
- Backend Component: This is subdivided into several modules:
- ruoyi-admin: Contains the main Spring Boot application entrypoints, web controllers (e.g., common, monitor, system, tool) and servlet initializers.
- ruoyi-system: Manages system-level domain entities and services (e.g., user management, department management, menu management, etc.).
- ruoyi-framework: Houses core configurations, aspects (such as logging, data source, security), interceptors, and common manager/utility classes. It is the backbone that all other modules leverage.
- ruoyi-common: Provides shared libraries (POJOs, utility classes, exception handling, annotations, filters) that are used across other backend modules.
- ruoyi-generator: Offers functionality to automatically generate code (controller, domain, mapper, service, etc.) for CRUD operations.
- ruoyi-quartz: Implements scheduling jobs and task configurations using Quartz, including job log recording.
- External Services & Integrations:
- Spring Security & JWT: For permission control and authentication.
- Redis: Used for caching and managing session/auth token data.
- Database: Though not explicitly shown, typical MySQL or other RDBMS connections are managed via MyBatis configurations.
- Possibly external configuration and logging services as evident from the presence of logback and Spring Boot configuration files.

##### Relationships and Interactions
- The ruoyi-ui (frontend) sends API requests (HTTP/REST) to backend endpoints provided by modules like ruoyi-admin.
- The backend architecture is layered:
- Controller Layer: Handles incoming requests (organized in multiple packages under ruoyi-admin, ruoyi-system, etc.).
- Service Layer: Implements business logic; these are coordinated by components in ruoyi-framework and ruoyi-common.
- Persistence Layer: Uses MyBatis in combination with XML/annotation-based mappers to interact with the database.
- Security is integrated across controllers and services via Spring Security configurations and JWT-based filters (handled in ruoyi-framework).
- The ruoyi-generator module, while a standalone functionality, can be seen as a utility that helps generate code for other parts of the system.
- The ruoyi-quartz module triggers scheduled tasks that may interact with various parts of the system (logging, notifications, etc.).

##### Important Architectural Patterns & Design Principles
- Multi-Module Maven Project: Each module handles a specific concern (core framework, system management, code generation, scheduling).
- MVC Pattern: Controllers, services, and DAOs are clearly separated within the backend modules.
- Separation of Concerns: There is a clear division between frontend (ruoyi-ui) and backend services.
- Use of Aspect-Oriented Programming (AOP): Aspects used for logging, data source management, rate limiting, etc.
- Security & Caching: Implementation of JWT for authentication and Redis for caching.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        FE("ruoyi-ui (Frontend – Vue)"):::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        BA("ruoyi-admin (Spring Boot Entry)"):::backend
        SYS("ruoyi-system (System Management)"):::backend
        FW("ruoyi-framework (Core Config & AOP)"):::backend
        COM("ruoyi-common (Shared Libraries)"):::common
        GEN("ruoyi-generator (Code Generation)"):::backend
        QTZ("ruoyi-quartz (Scheduling)"):::backend
    end

    %% External Services & Databases
    SEC("Spring Security & JWT"):::external
    RED("Redis (Caching)"):::external
    DB("Database (MySQL)"):::external

    %% Connections: Frontend to Backend
    FE -->|"API_call"| BA

    %% Connections: Backend interactions
    BA -->|"routes_to"| SYS
    BA -->|"uses"| FW
    BA -->|"utilizes"| COM
    BA -->|"triggers"| GEN
    BA -->|"schedules"| QTZ

    %% Module Dependencies
    SYS -->|"depends_on"| FW
    SYS -->|"depends_on"| COM

    %% Security and Persistence Integration
    FW -->|"secures"| SEC
    FW -->|"configures"| RED
    FW -->|"connects_to"| DB
    COM -->|"assists"| DB

    %% Additional Module Interactions
    GEN -->|"generates_for"| DB
    QTZ -->|"logs_to"| DB

    %% Click Events
    click FE "https://github.com/yangzongzhuan/ruoyi-vue/tree/master/ruoyi-ui"
    click BA "https://github.com/yangzongzhuan/ruoyi-vue/tree/master/ruoyi-admin"
    click SYS "https://github.com/yangzongzhuan/ruoyi-vue/tree/master/ruoyi-system"
    click FW "https://github.com/yangzongzhuan/ruoyi-vue/tree/master/ruoyi-framework"
    click COM "https://github.com/yangzongzhuan/ruoyi-vue/tree/master/ruoyi-common"
    click GEN "https://github.com/yangzongzhuan/ruoyi-vue/tree/master/ruoyi-generator"
    click QTZ "https://github.com/yangzongzhuan/ruoyi-vue/tree/master/ruoyi-quartz"

    %% Styles
    classDef frontend fill:#cce5ff,stroke:#004085,stroke-width:2px;
    classDef backend fill:#d4edda,stroke:#155724,stroke-width:2px;
    classDef common fill:#fff3cd,stroke:#856404,stroke-width:2px;
    classDef external fill:#f8d7da,stroke:#721c24,stroke-width:2px;
```
