# carole007/carole-admin architecture

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

- Interactive diagram: https://gitdiagram.com/carole007/carole-admin
- Repository: https://github.com/carole007/carole-admin

## Overview

##### Project type and purpose
- This is a full-stack, front-end/back-end-separated admin platform called Carole-Admin.
- Front-end: Vue3 + Vite + Element-Plus, based on RuoYi-Vue3.
- Back-end: NestJS (modular, Controller-Service architecture) + Prisma ORM + MySQL + ioredis + JWT + Swagger.
- Features: user/role/permission management, dynamic menus, code generation, caching/monitoring, rate limiting, scheduled tasks, file upload, email, API documentation.

##### File structure
- Top-level:
- front/ – Vue3 app (src, public, html templates, bin scripts, Vite config)
- server/ – NestJS app (src modules: admin, common, prisma, schedule, test, plus configs and scripts)
- carole.sql – initial DB dump
- Backend modules (server/src):
- admin/system & admin/gen – domain modules (controllers, services, DTOs)
- common – cross-cutting concerns (decorators, guards, filters, interceptors, middleware, pipes, Prisma client, utils, swagger vo, result wrappers)
- prisma/schema – database models, .env for DB URL
- schedule – Cron jobs
- Frontend structure (front/src):
- api – HTTP client wrappers per domain (login, menu, system, monitor, tool)
- components/layout/views – UI building blocks, layouts, pages
- router – Vue Router setup
- store – Vuex modules (app, user, permission, settings, tagsView, dict)
- plugins – custom Vue plugins (auth, cache, download, modal, tab)
- utils – shared helpers (request, auth, permissions, theme, validation)

##### README for additional insights
- Contains technology stack, setup instructions, built-in features list, config overview (config.ts), Prisma generation scripts, deployment notes, and code generation workflow.
- Confirms use of JWT for auth, Redis for caching & rate-limiting, scheduled Cron tasks, class-validator for DTO validation, Swagger UI for API docs.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User
    User["User (Browser)"]:::external

    %% Front-end Layer
    subgraph "Front-end Layer" 
        direction TB
        FE_Core["Vue3 App"]:::frontend
        FE_API["API Layer"]:::frontend
        FE_Components["UI Components"]:::frontend
        FE_Layout["Layout Components"]:::frontend
        FE_Router["Router Config"]:::frontend
        FE_Store["Vuex Store"]:::frontend
        FE_Plugins["Custom Plugins"]:::frontend
        FE_Utils["Utility Functions"]:::frontend
    end

    %% Back-end Layer
    subgraph "Back-end Layer"
        direction TB
        BE_Main["Main & App Module"]:::backend
        BE_Config["Configuration"]:::backend
        BE_AdminSys["Admin System Module"]:::backend
        BE_AdminGen["Code-Gen Module"]:::backend
        BE_Common["Common Module"]:::backend
        BE_Prisma["Prisma Client & Schemas"]:::backend
        BE_Schedule["Schedule (Cron) Module"]:::backend
        BE_Auth["Authentication Service"]:::backend
        BE_GenService["Code-Gen Service & Templates"]:::backend
        BE_Email["Email Utility"]:::backend
        BE_RedisUtil["Redis Utility"]:::backend
        BE_Validation["Validation Pipe"]:::backend
        BE_Throttler["Throttling Guard"]:::backend
        BE_SwaggerVO["Swagger VO Definitions"]:::backend
        BE_CtrlSvc["Controllers & Services"]:::backend
    end

    %% Data Stores & External
    MySQL["MySQL Database"]:::datastore
    Redis["Redis Cache"]:::datastore
    SMTP["SMTP Mail Server"]:::external
    SwaggerUI["Swagger UI (/api/docs)"]:::external

    %% Front-end to Back-end
    User -->|"HTTP/HTTPS"| FE_Core
    FE_Core -->|"REST Calls"| FE_API
    FE_API -->|"HTTP API Calls (JWT)"| BE_Main

    %% Front-end composition
    FE_Core --> FE_Components
    FE_Core --> FE_Layout
    FE_Core --> FE_Router
    FE_Core --> FE_Store
    FE_Core --> FE_Plugins
    FE_Core --> FE_Utils

    %% Back-end structure
    BE_Main --> BE_Config
    BE_Main --> BE_AdminSys
    BE_Main --> BE_AdminGen
    BE_Main --> BE_Common
    BE_Common --> BE_Prisma
    BE_Common --> BE_Auth
    BE_Common --> BE_GenService
    BE_Common --> BE_Email
    BE_Common --> BE_RedisUtil
    BE_Common --> BE_Validation
    BE_Common --> BE_Throttler
    BE_Common --> BE_SwaggerVO
    BE_AdminSys --> BE_CtrlSvc
    BE_AdminGen --> BE_CtrlSvc
    BE_CtrlSvc --> BE_Prisma

    %% Back-end to Data Stores & External
    BE_Prisma -->|"SQL Queries"| MySQL
    BE_RedisUtil -->|"Cache/Rate Limiting"| Redis
    BE_Auth --> Redis
    BE_Email --> SMTP
    BE_Schedule --> BE_CtrlSvc
    BE_Common --> SwaggerUI

    %% Click Events - Front-end
    click FE_Core "https://github.com/carole007/carole-admin/tree/master/front/src"
    click FE_API "https://github.com/carole007/carole-admin/tree/master/front/src/api"
    click FE_Components "https://github.com/carole007/carole-admin/tree/master/front/src/components"
    click FE_Layout "https://github.com/carole007/carole-admin/tree/master/front/src/layout"
    click FE_Router "https://github.com/carole007/carole-admin/blob/master/front/src/router/index.js"
    click FE_Store "https://github.com/carole007/carole-admin/tree/master/front/src/store/modules"
    click FE_Plugins "https://github.com/carole007/carole-admin/tree/master/front/src/plugins"
    click FE_Utils "https://github.com/carole007/carole-admin/tree/master/front/src/utils"

    %% Click Events - Back-end
    click BE_Main "https://github.com/carole007/carole-admin/blob/master/server/src/main.ts"
    click BE_Main "https://github.com/carole007/carole-admin/blob/master/server/src/app.module.ts"
    click BE_Config "https://github.com/carole007/carole-admin/blob/master/server/src/config.ts"
    click BE_Config "https://github.com/carole007/carole-admin/blob/master/server/src/.env.example"
    click BE_AdminSys "https://github.com/carole007/carole-admin/tree/master/server/src/admin/system"
    click BE_AdminGen "https://github.com/carole007/carole-admin/tree/master/server/src/admin/gen"
    click BE_Common "https://github.com/carole007/carole-admin/tree/master/server/src/common"
    click BE_Prisma "https://github.com/carole007/carole-admin/tree/master/server/src/common/prisma-client"
    click BE_Prisma "https://github.com/carole007/carole-admin/blob/master/server/src/prisma/schema.prisma"
    click BE_Schedule "https://github.com/carole007/carole-admin/blob/master/server/src/schedule/index.ts"
    click BE_Auth "https://github.com/carole007/carole-admin/blob/master/server/src/common/service/auth/auth.service.ts"
    click BE_GenService "https://github.com/carole007/carole-admin/tree/master/server/src/common/service/gen"
    click BE_GenService "https://github.com/carole007/carole-admin/tree/master/server/src/common/service/gen/gen-template"
    click BE_Email "https://github.com/carole007/carole-admin/blob/master/server/src/common/utils/email.ts"
    click BE_RedisUtil "https://github.com/carole007/carole-admin/blob/master/server/src/common/utils/redisUtils.ts"
    click BE_Validation "https://github.com/carole007/carole-admin/blob/master/server/src/common/pipe/validation.pipe.ts"
    click BE_Throttler "https://github.com/carole007/carole-admin/blob/master/server/src/common/guard/throttler/throttler-custom.guard.ts"
    click BE_SwaggerVO "https://github.com/carole007/carole-admin/tree/master/server/src/common/swagger/vo"

    %% Styles
    classDef frontend fill:#bbdefb,stroke:#1976d2,color:#0d47a1
    classDef backend fill:#c8e6c9,stroke:#388e3c,color:#1b5e20
    classDef datastore fill:#ffe0b2,stroke:#f57c00,color:#e65100
    classDef external fill:#e0e0e0,stroke:#757575,color:#424242
```
