# heeexy/springboot-shiro-vue architecture

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

## Overview

- Backend Service: Represent the Spring Boot application. Break this down further by explaining:
– Application Entry and Core Configuration: Highlight MyApplication.java and configuration classes (like CacheConfig and Exception Handling – GlobalExceptionHandler, etc.).
– Security & Permission System: Emphasize the use of custom annotations (@RequiresPermissions, Logical annotations) and AOP aspects (such as PermissionAspect and filters like RequestFilter and WebLogAspect) to implement permission verification.
– Controllers and Services: Note the separation between controllers (ArticleController, LoginController, UserController), service layers (ArticleService, LoginService, TokenService, UserService), DAOs, and data transfer objects (DTOs).
- External Interactions / Client-Server Communication: Show API endpoints that the Vue frontend calls on the Spring Boot backend. Emphasize token-based authentication (where the backend returns a token with permission data, as described in the sample JSON) instead of traditional sessions.

##### Relationships and Interactions
- The Vue frontend issuing REST API calls to the backend (for login, fetching permissions, data operations such as list/add/delete for articles/users).
- The backend’s internal flow: Controllers receive requests, invoke service logic, and interact with DAOs to access the database.
- The security workflow: How a login request results in a token being issued, which is then validated on subsequent API calls via custom annotation processing.
- Data flow for permission information: once the user logs in, the backend returns user permission data (menuList and permissionList), which then drives dynamic routing and UI rendering in the frontend.

##### Specific Technologies and Frameworks
- Backend: Java, Spring Boot, Maven (pom.xml), Shiro-inspired permission annotations, AOP, Spring’s exception handling, YAML configurations for different environments (application-prod.yml, etc.).
- Frontend: Vue.js, ElementUI, vue-router, Vuex for state management, and the vueAdmin-template approach for dynamic routing and permission filtering.
- Other: Database (as configured by db.sql and mapper XML files), along with build and configuration tools (e.g., Webpack for Vue).

##### Specific Elements
- Clear labels (use “Frontend (Vue)”, “Backend (Spring Boot)”, “Database”).
- API request/response flow,
- Data flow when fetching permission data after login,
- Internal calls between controllers, services, and DAOs.
- Annotations to identify cross-cutting components such as the PermissionAspect, RequestFilter, or other aspects.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend (Vue) Subgraph
    subgraph "Frontend (Vue)"
        F1["Dynamic Routing"]:::frontend
        F2["Views"]:::frontend
        F3["State Management"]:::frontend
        F4["Components"]:::frontend
        F5["Permission Directive"]:::frontend
        F6["API Utils"]:::frontend
        F7["Auth Utils"]:::frontend
    end

    %% Backend (Spring Boot) Subgraph
    subgraph "Backend (Spring Boot)"
        subgraph "Entry & Config"
            B1["Entry Point"]:::backend
            B2["Core Config"]:::backend
        end
        subgraph "Security & Permissions"
            B3["Annotation: Logical"]:::security
            B4["Annotation: RequiresPermissions"]:::security
            B5["Permission Aspect"]:::security
            B6["Request Filter"]:::security
            B7["WebLog Aspect"]:::security
        end
        subgraph "Controllers"
            B8["ArticleController"]:::backend
            B9["LoginController"]:::backend
            B10["UserController"]:::backend
        end
        subgraph "Services"
            B11["ArticleService"]:::backend
            B12["LoginService"]:::backend
            B13["TokenService"]:::backend
            B14["UserService"]:::backend
        end
    end

    %% Database Subgraph
    subgraph "Database"
        D1["Database Schema"]:::database
        D2["Article Mapper"]:::database
        D3["Login Mapper"]:::database
        D4["User Mapper"]:::database
    end

    %% External Interaction: Frontend to Backend (API Request)
    F7 -->|"REST_Request"| B9
    %% Backend Internal Flow
    B1 --> B2
    B2 --> B3
    B3 --> B4
    B4 --> B5
    B5 --> B6
    B6 --> B7
    B7 --> B8
    %% Controllers to Services Connections
    B8 --> B11
    B9 --> B12
    B10 --> B14
    %% Services to Database Connections
    B11 --> D1
    B12 --> D2
    B13 --> D3
    B14 --> D4
    %% Token & Permission Response back to Frontend
    B9 -->|"Token_Permission"| F1

    %% Click Events for Frontend Components
    click F1 "https://github.com/heeexy/springboot-shiro-vue/tree/master/vue/src/router/"
    click F2 "https://github.com/heeexy/springboot-shiro-vue/tree/master/vue/src/views/"
    click F3 "https://github.com/heeexy/springboot-shiro-vue/tree/master/vue/src/store/"
    click F4 "https://github.com/heeexy/springboot-shiro-vue/tree/master/vue/src/components/"
    click F5 "https://github.com/heeexy/springboot-shiro-vue/blob/master/vue/src/directives/permission.js"
    click F6 "https://github.com/heeexy/springboot-shiro-vue/blob/master/vue/src/utils/api.js"
    click F7 "https://github.com/heeexy/springboot-shiro-vue/blob/master/vue/src/utils/auth.js"

    %% Click Events for Backend Components
    click B1 "https://github.com/heeexy/springboot-shiro-vue/blob/master/back/src/main/java/com/heeexy/example/MyApplication.java"
    click B2 "https://github.com/heeexy/springboot-shiro-vue/tree/master/back/src/main/java/com/heeexy/example/config/"
    click B3 "https://github.com/heeexy/springboot-shiro-vue/blob/master/back/src/main/java/com/heeexy/example/config/annotation/Logical.java"
    click B4 "https://github.com/heeexy/springboot-shiro-vue/blob/master/back/src/main/java/com/heeexy/example/config/annotation/RequiresPermissions.java"
    click B5 "https://github.com/heeexy/springboot-shiro-vue/blob/master/back/src/main/java/com/heeexy/example/config/filter/PermissionAspect.java"
    click B6 "https://github.com/heeexy/springboot-shiro-vue/blob/master/back/src/main/java/com/heeexy/example/config/filter/RequestFilter.java"
    click B7 "https://github.com/heeexy/springboot-shiro-vue/blob/master/back/src/main/java/com/heeexy/example/config/filter/WebLogAspect.java"
    click B8 "https://github.com/heeexy/springboot-shiro-vue/blob/master/back/src/main/java/com/heeexy/example/controller/ArticleController.java"
    click B9 "https://github.com/heeexy/springboot-shiro-vue/blob/master/back/src/main/java/com/heeexy/example/controller/LoginController.java"
    click B10 "https://github.com/heeexy/springboot-shiro-vue/blob/master/back/src/main/java/com/heeexy/example/controller/UserController.java"
    click B11 "https://github.com/heeexy/springboot-shiro-vue/blob/master/back/src/main/java/com/heeexy/example/service/ArticleService.java"
    click B12 "https://github.com/heeexy/springboot-shiro-vue/blob/master/back/src/main/java/com/heeexy/example/service/LoginService.java"
    click B13 "https://github.com/heeexy/springboot-shiro-vue/blob/master/back/src/main/java/com/heeexy/example/service/TokenService.java"
    click B14 "https://github.com/heeexy/springboot-shiro-vue/blob/master/back/src/main/java/com/heeexy/example/service/UserService.java"

    %% Click Events for Database Components
    click D1 "https://github.com/heeexy/springboot-shiro-vue/blob/master/db.sql"
    click D2 "https://github.com/heeexy/springboot-shiro-vue/blob/master/back/src/main/resources/mapper/ArticleMapper.xml"
    click D3 "https://github.com/heeexy/springboot-shiro-vue/blob/master/back/src/main/resources/mapper/LoginMapper.xml"
    click D4 "https://github.com/heeexy/springboot-shiro-vue/blob/master/back/src/main/resources/mapper/UserMapper.xml"

    %% Styles for Different Layers
    classDef frontend fill:#AED6F1,stroke:#1B4F72,stroke-width:2px;
    classDef backend fill:#F9E79F,stroke:#B9770E,stroke-width:2px;
    classDef security fill:#D7BDE2,stroke:#6C3483,stroke-width:2px;
    classDef database fill:#F5B7B1,stroke:#943126,stroke-width:2px;
```
