RuoYi-Cloud Documentation

repository·master·Indexed 23 days ago

https://github.com/yangzongzhuan/ruoyi-cloud

An open-source, distributed microservices development platform based on Spring Boot, Spring Cloud, and Alibaba. It features a decoupled architecture using Nacos for service discovery, Redis for authentication, Sentinel for flow control, and Seata for distributed transactions. The platform supports multiple versions of Spring Boot (2.x, 3.x, 4.x) and provides various frontend options including Vue 2, Vue 3, and TypeScript.

Tokens
29K
Snippets
28
Records
154
Agent score
83%

What's inside RuoYi-Cloud

  1. Overview of RuoYi-Cloud Architecture

    master

    RuoYi-Cloud is a distributed microservices architecture based on a decoupled front-end and back-end.

    Core Technology Stack:

    • Frontend: Vue/Element UI.
    • Backend: Spring Boot, Spring Cloud & Alibaba.
    • Service Discovery & Configuration: Nacos.
    • Authentication & Permissions: Redis.
    • Flow Control: Sentinel.
    • Distributed Transactions: Seata.
  2. Explore built-in RuoYi-Cloud features

    master

    RuoYi-Cloud includes several built-in management features:

    • User & Access Management: User, Department, Post, Menu, and Role management (including data scope permissions).
    • System Configuration: Dictionary management, Parameter management, and Notification/Announcement management.
    • Logging & Monitoring: Operation logs, Login logs, Online user monitoring, and Service monitoring (CPU, Memory, Disk, etc.).
    • Task & Automation: Scheduled tasks (with execution logs) and Code Generation (supports Java, HTML, XML, SQL, and CRUD downloads).
    • Developer Tools: System API documentation generation, Online Builder (HTML generation), and Connection Pool monitoring (SQL performance analysis).
  3. Understand the RuoYi-Cloud system module structure

    master

    The backend is organized into several functional modules. Key modules include:

    • ruoyi-gateway: Gateway module (Port: 8080).
    • ruoyi-auth: Authentication center (Port: 9200).
    • ruoyi-api: Interface modules (e.g., ruoyi-api-system).
    • ruoyi-common: Common utility modules (Core, DataScope, Datasource, Log, Redis, Seata, Security, Sensitive, Swagger).
    • ruoyi-modules: Business logic modules:
      • ruoyi-system: System module (Port: 9201).
      • ruoyi-gen: Code generation (Port: 9202).
      • ruoyi-job: Scheduled tasks (Port: 9203).
      • ruoyi-file: File services (Port: 9300).
    • ruoyi-visual: Graphical management (e.g., ruoyi-visual-monitor on Port: 9100).
    • ruoyi-ui: Frontend framework.
    com.ruoyi     
    ├── ruoyi-ui              // 前端框架 [80]
    ├── ruoyi-gateway         // 网关模块 [8080]
    ├── ruoyi-auth            // 认证中心 [9200]
    ├── ruoyi-api             // 接口模块
    │       └── ruoyi-api-system                          // 系统接口
    ├── ruoyi-common          // 通用模块
    │       └── ruoyi-common-core                         // 核心模块
    │       └── ruoyi-common-datascope                    // 权限范围
    │       └── ruoyi-common-datasource                   // 多数据源
    │       └── ruoyi-common-log                          // 日志记录
    │       └── ruoyi-common-redis                        // 缓存服务
    │       └── ruoyi-common-seata                        // 分布式事务
    │       └── ruoyi-common-security                     // 安全模块
    │       └── ruoyi-common-sensitive                    // 数据脱敏
    │       └── ruoyi-common-swagger                      // 系统接口
    ├── ruoyi-modules         // 业务模块
    │       └── ruoyi-system                              // 系统模块 [9201]
    │       └── ruoyi-gen                                 // 代码生成 [9202]
    │       └── ruoyi-job                                 // 定时任务 [9203]
    │       └── ruoyi-file                                // 文件服务 [9300]
    ├── ruoyi-visual          // 图形化管理模块
    │       └── ruoyi-visual-monitor                      // 监控中心 [9100]
    └── pom.xml                // 公共依赖
  4. Set up the RuoYi-Vue frontend development environment

    master

    To start developing the RuoYi-Vue frontend, clone the repository, navigate to the ruoyi-ui directory, and install dependencies using npm.

    Note on dependency installation: It is recommended to avoid using cnpm as it may cause unpredictable bugs. If npm is slow, use the official npmmirror registry instead.

  5. Select the appropriate RuoYi-Cloud version branch

    master

    RuoYi-Cloud maintains multiple parallel branches for different Spring Boot versions. Choose the branch that matches your required JDK and Nacos versions:

    • master (Default): Spring Boot 4.x (Requires JDK 17+ and Nacos 3.x).
    • springboot3: Spring Boot 3.x (Requires JDK 17+ and Nacos 3.x).
    • springboot2: Spring Boot 2.x (Requires JDK 8+ and Nacos 2.x).
    | 名称 | 说明 | 地址 |
    | :--- | :--- | :--- |
    | master 默认分支 | Spring Boot 4.x (JDK 17+、Nacos 3.x) | https://gitee.com/y_project/RuoYi-Cloud |
    | springboot3 分支 | Spring Boot 3.x (JDK 17+、Nacos 3.x) | https://gitee.com/y_project/RuoYi-Cloud/tree/springboot3 |
    | springboot2 分支 | Spring Boot 2.x (JDK 8+、 Nacos 2.x) | https://gitee.com/y_project/RuoYi-Cloud/tree/springboot2 |
  6. Use SQL scripts for Docker MySQL initialization

    master
    The SQL files located in the docker/mysql/db/ directory are designed to be used with Docker container initialization. When using a Docker-based MySQL setup, placing these SQL scripts in the appropriate initialization directory of the MySQL container will allow the database schema and initial data to be automatically loaded upon container startup.
  7. Select the appropriate Frontend project

    master

    The frontend projects are compatible with different Vue versions and scripting languages. Choose based on your preferred stack:

    Project NameFrontend FrameworkScripting LanguageBuild ToolUI LibraryState ManagementRouting
    RuoYi-CloudVue 2JavaScriptVue CLIElement UIVuexVue Router 3
    RuoYi-Cloud-Vue3Vue 3JavaScriptViteElement PlusPiniaVue Router 4
    RuoYi-Cloud-Vue3-TypeScriptVue 3TypeScriptViteElement PlusPiniaVue Router 4
    | 项目名称 | **RuoYi-Cloud** | **RuoYi-Cloud-Vue3** | **RuoYi-Cloud-Vue3-TypeScript** |
    | :--- | :--- | :--- | :--- |
    | **前端框架** | Vue 2 | Vue 3 | Vue 3 |
    | **脚本语言** | JavaScript | JavaScript | TypeScript |
    | **构建工具** | Vue CLI | Vite | Vite |
    | **UI 组件库** | Element UI | Element Plus | Element Plus |
    | **状态管理** | Vuex | Pinia | Pinia |
    | **路由管理** | Vue Router 3 | Vue Router 4 | Vue Router 4 |
  8. TopNav UI Component Overview

    master

    The TopNav component is a horizontal navigation bar used in the Ruoyi-Cloud frontend layout. It dynamically renders top-level menu items based on the user's permissions and the current routing configuration.

    Key features include:

    • Dynamic Menu Rendering: It pulls routes from the Vuex store (permission.topbarRouters).
    • Responsive Folding: If the number of menu items exceeds the calculated visibleNumber (based on window width), the remaining items are automatically collapsed into a "更多菜单" (More Menus) submenu.
    • Smart Routing:
      • If a menu item is an external HTTP/HTTPS link, it opens in a new browser tab.
      • If a menu item has no children, it navigates internally and hides the sidebar.
      • If a menu item has children, it activates the corresponding sidebar menu items via the SET_SIDEBAR_ROUTERS mutation.
    • Theme Integration: It uses a CSS variable --theme derived from the application settings to style the active menu indicator.