# baiwumm/vue3-admin architecture

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

- Interactive diagram: https://gitdiagram.com/baiwumm/vue3-admin
- Repository: https://github.com/baiwumm/vue3-admin

## Overview

##### Main Components Overview
The system should be represented as a three-tier architecture with the following main components:

Frontend (Web Layer):
- Vue3.5 Application
- Ant Design Vue Components
- UnoCSS Styling
- Pinia State Management
- Client-side Routing

Backend (Server Layer):
- Nest.js Application
- Authentication/Authorization
- API Controllers
- Business Services
- SSE (Server-Sent Events) for real-time notifications

Database Layer:
- PostgreSQL Database
- Prisma ORM

##### Key Architectural Elements

A. Frontend Architecture:
**Web Application**
- Core Modules
- Authentication
- Routing System
- State Management (Pinia)
- Internationalization
- Layout Components
- Admin Layout
- Global Header
- Menu System
- Theme Management
- Feature Modules
- User Management
- Role Management
- Menu Management
- System Settings
- Shared Services
- API Services
- Authentication
- Utils

B. Backend Architecture:
**Server Application**
- Core Modules
- Authentication
- Authorization
- Logging
- Feature Modules
- User Module
- Role Module
- Menu Module
- System Module
- Shared Services
- Prisma Service
- SSE Service
- Infrastructure
- Middleware
- Guards
- Filters

##### Data Flow Representation

Following key interactions:
- Authentication flow
- API request/response cycle
- Real-time SSE notifications
- Database operations through Prisma
- Dynamic route generation based on user roles

##### Key Integration Points

Critical integration points:
- Frontend-Backend API communication
- Authentication token handling
- SSE connection for real-time messages
- Database access through Prisma
- Dynamic menu generation based on user roles

##### Security Layer

Security components:
- JWT authentication
- Role-based access control
- API guards and interceptors
- Request validation
- Error handling

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Web["Frontend Layer"]
        direction TB
        Auth["Authentication"]:::frontend
        Layout["Layout System"]:::frontend
        State["State Management"]:::frontend
        Features["Feature Modules"]:::frontend
        I18n["Internationalization"]:::frontend
        APIService["API Services"]:::frontend
        
        subgraph FrontendFeatures["Feature Modules Detail"]
            UserManageF["User Management"]:::frontend
            RoleManageF["Role Management"]:::frontend
            MenuManageF["Menu Management"]:::frontend
        end
    end

    subgraph Server["Backend Layer"]
        direction TB
        AuthB["Authentication"]:::backend
        Guards["Guards & Filters"]:::backend
        PrismaService["Prisma Service"]:::backend
        SSE["SSE Service"]:::backend
        
        subgraph BackendFeatures["Feature Modules Detail"]
            UserManageB["User Management"]:::backend
            RoleManageB["Role Management"]:::backend
            MenuManageB["Menu Management"]:::backend
        end
    end

    subgraph DB["Database Layer"]
        PostgreSQL[(PostgreSQL)]:::database
        PrismaSchema["Prisma Schema"]:::database
    end

    %% Frontend Relationships
    Auth --> Layout
    Auth --> State
    Layout --> State
    Features --> State
    Features --> APIService
    I18n --> Layout

    %% Backend Relationships
    AuthB --> Guards
    Guards --> PrismaService
    SSE --> Guards
    BackendFeatures --> PrismaService

    %% Cross-layer Relationships
    APIService ==> AuthB
    APIService ==> BackendFeatures
    SSE ==> Auth
    PrismaService --> PostgreSQL
    PrismaService --> PrismaSchema

    %% Feature Module Relationships
    UserManageF --> UserManageB
    RoleManageF --> RoleManageB
    MenuManageF --> MenuManageB

    %% Click Events
    click Auth "https://github.com/baiwumm/vue3-admin/tree/main//web/src/store/modules/auth"
    click Layout "https://github.com/baiwumm/vue3-admin/tree/main//web/src/layouts/base-layout"
    click State "https://github.com/baiwumm/vue3-admin/tree/main//web/src/store/modules"
    click APIService "https://github.com/baiwumm/vue3-admin/tree/main//web/src/service/api"
    click I18n "https://github.com/baiwumm/vue3-admin/tree/main//web/src/locales"
    click UserManageF "https://github.com/baiwumm/vue3-admin/tree/main//web/src/views/system-manage/user-manage"
    click RoleManageF "https://github.com/baiwumm/vue3-admin/tree/main//web/src/views/system-manage/role-manage"
    click MenuManageF "https://github.com/baiwumm/vue3-admin/tree/main//web/src/views/system-manage/menu-manage"
    click AuthB "https://github.com/baiwumm/vue3-admin/tree/main//server/src/modules/auth"
    click Guards "https://github.com/baiwumm/vue3-admin/tree/main//server/src/filter"
    click PrismaService "https://github.com/baiwumm/vue3-admin/blob/main//server/src/modules/prisma/prisma.service.ts"
    click UserManageB "https://github.com/baiwumm/vue3-admin/tree/main//server/src/modules/system-manage/user-manage"
    click RoleManageB "https://github.com/baiwumm/vue3-admin/tree/main//server/src/modules/system-manage/role-manage"
    click MenuManageB "https://github.com/baiwumm/vue3-admin/tree/main//server/src/modules/system-manage/menu-manage"
    click PrismaSchema "https://github.com/baiwumm/vue3-admin/blob/main//server/prisma/schema.prisma"

    %% Styling
    classDef frontend fill:#2196F3,color:white
    classDef backend fill:#4CAF50,color:white
    classDef database fill:#FFC107,color:black
    
    %% Legend
    subgraph Legend
        Frontend["Frontend Component"]:::frontend
        Backend["Backend Component"]:::backend
        Database["Database Component"]:::database
    end
```
