# yimiaoopen/nodcloud-erp-v6 architecture

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

- Interactive diagram: https://gitdiagram.com/yimiaoopen/nodcloud-erp-v6
- Repository: https://github.com/yimiaoopen/nodcloud-erp-v6

## Overview

##### Project Type and Purpose
- This is a full-stack web ERP system (“点可云ERP-开源进销存系统”) built on the ThinkPHP MVC framework (backend) and LayUI/jQuery (frontend). It provides modules for procurement, sales, inventory, finance, reports, plus a plug-in/addons mechanism.

##### File Structure Analysis
- Top-level:
- index.php (ThinkPHP front controller)
- application/ (main MVC app: config, controllers, models, views, validators)
- thinkphp/ (framework core library)
- addons/ (plugin modules, each with its own MVC structure and config)
- skin/ (static assets: CSS, JS, fonts, images)
- install/ (installation wizard: PHP scripts, DB schema templates)
- runtime/ (cache/log/temp)
- vendor/ (third-party libraries if any)
- Patterns:
- MVC in application/index
- Modular/addon MVC under addons/*
- Front controller → routing (application/route.php) → controllers
- Validation layer (application/index/validate)
- Skin folder holds all UI resources, loaded by views.

##### Key README Insights
- Backend: ThinkPHP
- Frontend: LayUI
- Data store: MySQL (configured in application/config.php)
- Supports multiple session/cache drivers (Redis/Memcache)
- Plugin architecture: addons loaded dynamically via config.php in each addon.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Client Layer
    Browser["Browser (LayUI/jQuery)"]:::frontend
    Browser -->|HTTP Request| WebServer

    %% Infrastructure Layer
    subgraph "Infrastructure" 
        direction TB
        WebServer["Nginx/Apache + PHP-FPM"]:::infra
        FileSystem["Filesystem: upload/ runtime/"]:::infra
        Skin["Static Assets (skin/)"]:::infra
    end
    WebServer --> FrontController
    Browser -->|Fetch Assets| Skin
    Skin --> Browser
    FileSystem --- WebServer

    %% Core Application Layer
    subgraph "PHP Application" 
        direction TB
        FrontController["ThinkPHP Front Controller\n(index.php)"]:::core
        Bootstrap["ThinkPHP Bootstrap/Start\n(thinkphp/start.php)"]:::core
        CoreLib["Framework Core Library\n(thinkphp/)"]:::core
        Config["Global Configuration\n(application/config.php)"]:::core
        Common["Common Helpers\n(application/common.php)"]:::core
        Router["Routing & Dispatcher\n(application/route.php)"]:::core
        Controllers["Core Controllers\n(application/index/controller/)"]:::core
        Models["Core Models\n(application/index/model/)"]:::core
        Validate["Validation Layer\n(application/index/validate/)"]:::core
        Views["View Templates\n(application/index/view/)"]:::core
        Command["Command Definitions\n(application/command.php)"]:::core
        Tags["Custom Tags\n(application/tags.php)"]:::core
        Vendor["Composer Dependencies\n(vendor/)"]:::core
    end

    WebServer --> FrontController
    FrontController --> Bootstrap
    Bootstrap --> CoreLib
    Bootstrap --> Config
    Bootstrap --> Common
    Bootstrap --> Router
    Router --> Controllers
    Controllers --> Validate
    Validate --> Models
    Controllers --> Models
    Models --> MySQL
    Models --> Cache
    Controllers --> Views
    Views --> Browser
    Command -.-> Controllers
    Tags -.-> Views
    Vendor --> CoreLib

    %% Add-ons Layer
    subgraph "Add-ons Manager" 
        direction TB
        AddonsManager["Add-ons Manager\n(addons/)"]:::addon
        AddonMVC["Plugin MVC Structure\n(addons/*/controller,\nmodel,view,validate,skin)"]:::addon
    end
    Bootstrap --> AddonsManager
    AddonsManager --> AddonMVC
    AddonMVC --> Controllers
    AddonMVC --> Models
    AddonMVC --> Validate
    AddonMVC --> Views
    AddonMVC --> Skin

    %% Installer
    Install["Installation Module\n(install/)"]:::infra
    WebServer --> Install
    Install -->|Initialize DB| MySQL

    %% Data Stores
    subgraph "Data Storage" 
        direction TB
        MySQL["MySQL Database"]:::db
        Cache["Redis/Memcache"]:::db
    end
    Models --> MySQL
    Models --> Cache

    %% Third-Party Integrations
    ThirdParty["Third-Party Services\n(email, SMS)"]:::external
    Controllers --> ThirdParty

    %% Click Events
    click FrontController "https://github.com/yimiaoopen/nodcloud-erp-v6/blob/main/index.php"
    click Bootstrap "https://github.com/yimiaoopen/nodcloud-erp-v6/blob/main/thinkphp/start.php"
    click CoreLib "https://github.com/yimiaoopen/nodcloud-erp-v6/tree/main/thinkphp/"
    click Router "https://github.com/yimiaoopen/nodcloud-erp-v6/blob/main/application/route.php"
    click Config "https://github.com/yimiaoopen/nodcloud-erp-v6/blob/main/application/config.php"
    click Common "https://github.com/yimiaoopen/nodcloud-erp-v6/blob/main/application/common.php"
    click Controllers "https://github.com/yimiaoopen/nodcloud-erp-v6/tree/main/application/index/controller/"
    click Models "https://github.com/yimiaoopen/nodcloud-erp-v6/tree/main/application/index/model/"
    click Validate "https://github.com/yimiaoopen/nodcloud-erp-v6/tree/main/application/index/validate/"
    click Views "https://github.com/yimiaoopen/nodcloud-erp-v6/tree/main/application/index/view/"
    click AddonsManager "https://github.com/yimiaoopen/nodcloud-erp-v6/tree/main/addons/"
    click Skin "https://github.com/yimiaoopen/nodcloud-erp-v6/tree/main/skin/"
    click Install "https://github.com/yimiaoopen/nodcloud-erp-v6/tree/main/install/"
    click FileSystem "https://github.com/yimiaoopen/nodcloud-erp-v6/tree/main/runtime/"
    click Command "https://github.com/yimiaoopen/nodcloud-erp-v6/blob/main/application/command.php"
    click Tags "https://github.com/yimiaoopen/nodcloud-erp-v6/blob/main/application/tags.php"
    click Vendor "https://github.com/yimiaoopen/nodcloud-erp-v6/tree/main/vendor/"

    %% Styles
    classDef frontend fill:#E8F6FF,stroke:#0288D1,color:#000
    classDef infra fill:#E3FCEF,stroke:#1E8E3E,color:#000
    classDef core fill:#E8F4E8,stroke:#1E7135,color:#000
    classDef addon fill:#FFF3E0,stroke:#FB8C00,color:#000
    classDef db fill:#F3E5F5,stroke:#8E24AA,color:#000
    classDef external fill:#FFEBEE,stroke:#D32F2F,color:#000
```
