# qiushuangju/qshop architecture

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

- Interactive diagram: https://gitdiagram.com/qiushuangju/qshop
- Repository: https://github.com/qiushuangju/qshop

## Overview

##### Project Type and Purpose
- This is a full-stack, front-end/back-end-separated e-commerce system (“QShop商城”) comprising:
- Backend: .NET 6 solution (`QShop.sln`) with layered architecture (API, Application, Repository, Shared).
- Mobile Frontend: Uni-App cross-platform app (`2_UniApp`).
- Admin Frontend: Vue.js + Element-UI + Ant-Design-Vue administration portal (`3_PcAdmin`).
- Database: MySQL (initialization in `8_数据库脚本/MySql初始化.sql`).
- External services: shipping (KuaiDi100, KuaiDiNiao), SMS, WeChat Pay, third-party auth.

##### File Structure
- Top-level directories:
1_Api:
- Qs.WebApi – ASP.NET Core WebAPI project exposing REST controllers.
- Qs.App – Application/business logic layer (services, jobs, strategies).
- Qs.Repository – Data access (Entity models, Repository & UnitOfWork).
- Qs.Comm – Shared utilities, caching, middleware, config, Snowflake ID generator.
2_UniApp: Mobile client source (pages, components, API wrappers, store).
3_PcAdmin: Admin portal (Vue.js project, API calls, components, views).
8_数据库脚本: DB DDL.
- Architectural choices: layered (Presentation → API → Application → Repository → Database), Strategy pattern for auth, Factory for express providers, Repository & UnitOfWork patterns, Hosted background jobs via Quartz.

##### README
- Confirms: front/back separation, .NET6, WebAPI, Swagger, NUnit tests, Uni-App, Vue/Element-UI, Ant-Design-Vue, RBAC, open-source.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Clients"
        MobileClient["Mobile Client (Uni-App)"]:::client
        AdminClient["Admin Client (Vue.js Admin)"]:::client
    end

    subgraph "API Layer"
        QsWebApi["Qs.WebApi (Controllers)"]:::api
    end

    subgraph "Application Layer"
        BizServices["Qs.App (Business Services)"]:::service
        FactoryExpress["FactoryExpress"]:::service
        ApiKuaiDi100["ApiKuaiDi100"]:::service
        ApiKuaiDiNiao["ApiKuaiDiNiao"]:::service
        SmsHelper["AppSendSms"]:::service
        WxPay["WeChat Pay"]:::service
        AuthStrategies["AuthStrategies"]:::service
        QuartzService["QuartzService (Hosted Jobs)"]:::service
        Jobs["Jobs"]:::service
    end

    subgraph "Data Layer"
        Repository["Qs.Repository"]:::repo
        BaseRepo["BaseRepository"]:::repo
        UnitWork["UnitOfWork"]:::repo
        Domain["Domain Models"]:::repo
        DbContext["QsDBContext"]:::repo
    end

    QsComm["Qs.Comm (Shared Library)"]:::shared
    MySQL["MySQL Database"]:::db

    subgraph "Third-Party Services"
        ShippingAPIs["Shipping APIs"]:::external
        SMSGateway["SMS Gateway"]:::external
        WeChatPayExt["WeChat Pay"]:::external
        OAuth["OAuth/SSO Providers"]:::external
    end

    MobileClient -->|"HTTPS/REST"| QsWebApi
    AdminClient -->|"HTTPS/REST"| QsWebApi
    QsWebApi -->|"in-process calls"| BizServices
    QsWebApi -->|"uses utilities"| QsComm

    BizServices -->|"calls data layer"| Repository
    BizServices -->|"creates via factory"| FactoryExpress
    BizServices -->|"strategy providers"| AuthStrategies
    BizServices -->|"HTTP calls"| ShippingAPIs
    BizServices -->|"HTTP calls"| SMSGateway
    BizServices -->|"HTTP calls"| WeChatPayExt

    QuartzService -.->|"scheduled tasks"| BizServices
    Jobs -.->|"execute via scheduler"| QuartzService

    Repository -->|"uses ORM"| DbContext
    DbContext --> MySQL
    Repository -->|"uses utilities"| QsComm
    BizServices -->|"uses utilities"| QsComm

    click MobileClient "https://github.com/qiushuangju/qshop/tree/main/2_UniApp"
    click AdminClient "https://github.com/qiushuangju/qshop/tree/main/3_PcAdmin"
    click QsWebApi "https://github.com/qiushuangju/qshop/blob/main/1_Api/Qs.WebApi"
    click BizServices "https://github.com/qiushuangju/qshop/blob/main/1_Api/Qs.App"
    click FactoryExpress "https://github.com/qiushuangju/qshop/blob/main/1_Api/Qs.App/ApiExpress/FactoryExpress.cs"
    click ApiKuaiDi100 "https://github.com/qiushuangju/qshop/tree/main/1_Api/Qs.App/ApiExpress/ApiKuaiDi100"
    click ApiKuaiDiNiao "https://github.com/qiushuangju/qshop/tree/main/1_Api/Qs.App/ApiExpress/ApiKuaiDiNiao"
    click SmsHelper "https://github.com/qiushuangju/qshop/tree/main/1_Api/Qs.App/AppSendSms"
    click WxPay "https://github.com/qiushuangju/qshop/tree/main/1_Api/Qs.App/Wx"
    click AuthStrategies "https://github.com/qiushuangju/qshop/tree/main/1_Api/Qs.App/AuthStrategies"
    click QuartzService "https://github.com/qiushuangju/qshop/blob/main/1_Api/Qs.App/HostedService/QuartzService.cs"
    click Jobs "https://github.com/qiushuangju/qshop/tree/main/1_Api/Qs.App/Jobs"
    click Repository "https://github.com/qiushuangju/qshop/blob/main/1_Api/Qs.Repository"
    click BaseRepo "https://github.com/qiushuangju/qshop/blob/main/1_Api/Qs.Repository/BaseRepository.cs"
    click UnitWork "https://github.com/qiushuangju/qshop/blob/main/1_Api/Qs.Repository/UnitWork.cs"
    click Domain "https://github.com/qiushuangju/qshop/tree/main/1_Api/Qs.Repository/Domain"
    click DbContext "https://github.com/qiushuangju/qshop/blob/main/1_Api/Qs.Repository/QsDBContext.cs"
    click QsComm "https://github.com/qiushuangju/qshop/blob/main/1_Api/Qs.Comm"
    click MySQL "https://github.com/qiushuangju/qshop/blob/main/8_数据库脚本/MySql初始化.sql"

    classDef client fill:#DFAAFF,stroke:#333,stroke-width:1px
    classDef api fill:#CCE5FF,stroke:#333,stroke-width:1px
    classDef service fill:#B3D9FF,stroke:#333,stroke-width:1px
    classDef repo fill:#99CCFF,stroke:#333,stroke-width:1px
    classDef shared fill:#E6E6E6,stroke:#333,stroke-width:1px
    classDef db fill:#B2FFB2,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
    classDef external fill:#FFD699,stroke:#333,stroke-width:1px,stroke-dasharray: 5 5
```
