# dymproject/purest-admin architecture

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

- Interactive diagram: https://gitdiagram.com/dymproject/purest-admin
- Repository: https://github.com/dymproject/purest-admin

## Overview

##### Project Type and Purpose
- This is a full-stack, truly front-end/back-end separated “Purest Admin” system.
- Back end: .NET 8 Web API built on a streamlined ABP-style modular framework, using SqlSugar for data access, a custom workflow engine, SignalR for real-time features, and background workers.
- Front end: a Vue3/Vite SPA (client-vue/pure-admin) and a WPF desktop client (client-wpf) that both consume the HTTP API.
- It targets RBAC-based permission management and is designed as a template for rapid secondary development.

##### File Structure Highlights
- api/…
- PurestAdmin.Api.Host: HTTP host and middleware (authentication, exception filters, routing)
- PurestAdmin.Application: application services (Auth, User, Role, Workflow, etc.)
- PurestAdmin.Core: cross-cutting concerns (caching, encryption, file storage, SignalR extensions)
- PurestAdmin.SqlSugar: data layer (entities, repositories, DB connection)
- PurestAdmin.Workflow: workflow engine modules and definition/instance services
- PurestAdmin.Multiplex: SignalR hubs and event-bus subscribers
- PurestAdmin.BackgroundService: long-running background jobs (email, auditing, notifications)
- PurestAdmin.Zero: code-generation and data seed templates
- client-vue/pure-admin/: Vue3 SPA
- client-wpf/: WPF/Prism desktop client
- screenshot/: UI mock-ups

##### Key Architecture Principles
- Strict separation of UI and API: clients know nothing about specific routes; they fetch “feature codes” from the API and mount UI routes/permissions at runtime.
- Modular server architecture: each module (Auth, Workflow, Data, Multiplex, Background) is an independent ABP module.
- Single-token silent refresh: custom JWT middleware handles refresh without a separate refresh token.
- Event-driven and real-time: SignalR hubs for online user updates, event bus for background processing.
- Workflow engine: roadmap of workflow definitions → execution → instance management.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Clients"
        WebSPA["Web SPA<br/>(Vue3/Vite)"]:::client
        WPFApp["WPF Desktop App<br/>(Prism+Flurl)"]:::client
    end

    subgraph "API Server"
        subgraph "Host & Middleware"
            APIHost["API Host<br/>(.NET 8 Web API)"]:::api
        end
        subgraph "Application Layer"
            AppServ["Application Services"]:::api
        end
        subgraph "Domain/Core Layer"
            Core["Core (Caching, Encryption, File Storage)"]:::api
        end
        subgraph "Data Access Layer"
            DataAccess["Data Access (SqlSugar)"]:::api
        end
        subgraph "Workflow Module"
            Workflow["Workflow Engine"]:::api
        end
        subgraph "SignalR / Multiplex"
            MultiplexConst["Mux Contracts"]:::api
            MultiplexImpl["Mux Implementation"]:::api
        end
        subgraph "Zero Module"
            ZeroMod["CodeGen & Seed"]:::api
        end
    end

    subgraph "Event Bus & Background Workers"
        EventBus["Event Bus"]:::bg
        BgWorker["Background Service Worker"]:::bg
    end

    subgraph "Data Stores"
        DB["Primary DB<br/>(SQL Server/MySQL/Oracle)"]:::data
        RelModel["ER Diagrams & SQL Scripts"]:::data
    end

    subgraph "External Services"
        OAuth["OAuth2 Providers"]:::ext
        SMTP["Email SMTP"]:::ext
        Redis["Redis Cache (optional)"]:::ext
        Screens["UI Mock-ups"]:::ext
    end

    WebSPA -->|HTTP/HTTPS| APIHost
    WPFApp -->|HTTP/HTTPS| APIHost
    APIHost -->|calls| AppServ
    AppServ -->|uses| Core
    Core -->|ORM| DataAccess
    DataAccess -->|SQL| DB
    APIHost -->|uses| MultiplexConst
    MultiplexConst -->|implements| MultiplexImpl
    MultiplexImpl -->|WebSockets/SignalR| WebSPA
    MultiplexImpl -->|WebSockets/SignalR| WPFApp
    APIHost -->|executes| Workflow
    Workflow -->|read/write| DB
    Workflow -->|notifies| WebSPA
    Workflow -->|notifies| WPFApp
    APIHost -->|publishes events| EventBus
    EventBus -->|triggers| BgWorker
    BgWorker -->|jobs| DB
    BgWorker -->|sends email| SMTP
    Core -->|caching| Redis
    RelModel -->|models| DB
    Screens -->|design| WebSPA

    click WebSPA "https://github.com/dymproject/purest-admin/tree/main/client-vue/pure-admin"
    click WPFApp "https://github.com/dymproject/purest-admin/tree/main/client-wpf"
    click APIHost "https://github.com/dymproject/purest-admin/blob/main/api/PurestAdmin.Api.Host"
    click AppServ "https://github.com/dymproject/purest-admin/blob/main/api/PurestAdmin.Application"
    click Core "https://github.com/dymproject/purest-admin/blob/main/api/PurestAdmin.Core"
    click DataAccess "https://github.com/dymproject/purest-admin/blob/main/api/PurestAdmin.SqlSugar"
    click Workflow "https://github.com/dymproject/purest-admin/blob/main/api/PurestAdmin.Workflow"
    click MultiplexConst "https://github.com/dymproject/purest-admin/blob/main/api/PurestAdmin.Multiplex.Contracts"
    click MultiplexImpl "https://github.com/dymproject/purest-admin/blob/main/api/PurestAdmin.Multiplex"
    click BgWorker "https://github.com/dymproject/purest-admin/blob/main/api/PurestAdmin.BackgroundService"
    click ZeroMod "https://github.com/dymproject/purest-admin/blob/main/api/PurestAdmin.Zero"
    click RelModel "https://github.com/dymproject/purest-admin/tree/main/relationship-model"
    click Screens "https://github.com/dymproject/purest-admin/tree/main/screenshot"

    classDef client fill:#cce5ff,stroke:#036,stroke-width:1px
    classDef api fill:#d4edda,stroke:#155724,stroke-width:1px
    classDef data fill:#fff3cd,stroke:#856404,stroke-width:1px
    classDef ext fill:#e2e3e5,stroke:#6c757d,stroke-width:1px
    classDef bg fill:#e2dbf5,stroke:#6f42c1,stroke-width:1px
```
