# rainmango/ruoyi-vue3 architecture

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

- Interactive diagram: https://gitdiagram.com/rainmango/ruoyi-vue3
- Repository: https://github.com/rainmango/ruoyi-vue3

## Overview

##### Project Type and Purpose
- This is a modern frontend single-page application (SPA) built with Vue3. It is an enterprise-grade admin dashboard/management system (ruoyi-vue3) that includes a range of features like system management, charts, document handling, user management, and other business functionalities.
- The project is highly modular and uses TypeScript; it leverages environment-based configuration, unit tests (Jest) and end-to-end tests (Cypress). Its architecture is tailored for scalable and maintainable admin systems.

##### Analyzing the File Structure
- Top-Level Files & Environment: Multiple .env files for development, production, and test builds indicate environment-specific configurations. Files such as babel.config.js, vue.config.js, and tsconfig.json show the use of modern JavaScript/TypeScript build tools.
- Public Directory: Contains static assets and essential HTML templates (e.g., index.html), plus resources for third-party integrations like tinymce.
- src Directory: This is the heart of the SPA and is organized into clearly defined subdirectories:
– Components: Contains reusable Vue components (e.g., navigation, charts, editor, custom UI widgets) and specialized components (like tinymce integration).
– Views: Divided into various modules (dashboard, system, charts, excel, monitor, etc.), indicating the routing and the page-level composition.
– Router: Clearly separated into constant (global) routes and permission-based dynamic routes, supporting role-based access and nested navigation.
– Store: Modular state management using separate modules (e.g., app, permission, settings, user) to manage different slices of the application-wide state.
– Config, Assets, Directives, and APIs: All support layered configuration, styling, global actions (custom directives like clipboard, draggable dialogs), and communication with backend services (RESTful API calls segregated into functional areas like system and monitor).
– Tests: Contains both unit and end-to-end testing configurations, ensuring reliable code quality and behavior.

##### Final Touches
– Ensure that every component (even if it’s a directory) is represented by its functional role rather than sheer file count.

## Diagram (Mermaid)

```mermaid
flowchart TD
    User["User"]:::user
    EnvConfig["Env Config"]:::config

    subgraph "Frontend Core"
        FC_Main["Main (main.ts)"]:::frontend
        FC_App["App Component (App.vue)"]:::frontend
        FC_Main --> FC_App
    end

    LayoutUI["Layout & UI Components"]:::layout
    RouterModule["Router Module"]:::router
    StateMgmt["State Management"]:::store
    APIServices["APIs & Services"]:::api
    BackendServer["Backend API Server"]:::backend

    subgraph "External Integrations & Plugins"
        TinyMCE["Tinymce Integration"]:::external
        Plugins["Plugins"]:::external
        TinyMCE --> Plugins
    end

    TestInfra["Test Infrastructure"]:::test

    %% Relationships
    EnvConfig --> FC_Main
    FC_App --> LayoutUI
    User --> LayoutUI
    LayoutUI --> RouterModule
    LayoutUI --> StateMgmt
    StateMgmt --> APIServices
    APIServices --> BackendServer
    TinyMCE --> LayoutUI
    Plugins --> LayoutUI

    %% Testing influences major modules
    TestInfra -.-> FC_Main
    TestInfra -.-> LayoutUI
    TestInfra -.-> RouterModule
    TestInfra -.-> StateMgmt
    TestInfra -.-> APIServices

    %% Click Events
    click FC_Main "https://github.com/rainmango/ruoyi-vue3/blob/main/src/main.ts"
    click FC_App "https://github.com/rainmango/ruoyi-vue3/blob/main/src/App.vue"
    click LayoutUI "https://github.com/rainmango/ruoyi-vue3/tree/main/src/layout"
    click RouterModule "https://github.com/rainmango/ruoyi-vue3/tree/main/src/router"
    click StateMgmt "https://github.com/rainmango/ruoyi-vue3/tree/main/src/store"
    click APIServices "https://github.com/rainmango/ruoyi-vue3/tree/main/src/apis"
    click TinyMCE "https://github.com/rainmango/ruoyi-vue3/tree/main/public/tinymce"
    click Plugins "https://github.com/rainmango/ruoyi-vue3/tree/main/src/plugins"
    click EnvConfig "https://github.com/rainmango/ruoyi-vue3/tree/main/src/config"
    click TestInfra "https://github.com/rainmango/ruoyi-vue3/tree/main/tests"

    %% Styles
    classDef frontend fill:#B3E5FC,stroke:#0288D1,stroke-width:2px;
    classDef layout fill:#FFECB3,stroke:#FFA000,stroke-width:2px;
    classDef router fill:#C8E6C9,stroke:#388E3C,stroke-width:2px;
    classDef store fill:#D1C4E9,stroke:#7B1FA2,stroke-width:2px;
    classDef api fill:#FFCDD2,stroke:#C62828,stroke-width:2px;
    classDef external fill:#E1BEE7,stroke:#8E24AA,stroke-width:2px;
    classDef config fill:#F0F4C3,stroke:#7CB342,stroke-width:2px;
    classDef test fill:#CFD8DC,stroke:#607D8B,stroke-width:2px;
    classDef backend fill:#FFF9C4,stroke:#FBC02D,stroke-width:2px;
    classDef user fill:#DCEDC8,stroke:#689F38,stroke-width:2px;
```
