# ant-design/pro-components architecture

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

- Interactive diagram: https://gitdiagram.com/ant-design/pro-components
- Repository: https://github.com/ant-design/pro-components

## Overview

##### Project type and purpose
- This is an open-source React UI component library (“@ant-design/pro-components”) built on top of Ant Design.
- It provides enterprise-grade, pre-built components (cards, forms, tables, layouts, etc.), plus tooling for docs (demos, Dumi), automated builds, tests, and publishing.

##### File structure
- **src/**
- Organized by feature/module: card, descriptions, field, form, layout, list, provider, skeleton, table, utils.
- Each module contains one or more React components, styles, and types.
- **demos/**
- Live examples for each component group, used by Dumi to generate interactive docs.
- **site/**
- Markdown (.md/.mdx) and configuration for the Dumi-powered documentation site.
- **scripts/**
- Build and release automation (father bundler config, changelog generation, path fixes, publish scripts).
- **tests/**
- Unit and snapshot tests (Vitest/Jest), organized per module and per demo.
- **root-level configs**
- tsconfig.json, .eslintrc, .prettierrc, .fatherrc.ts, dumi config (dumirc.ts), CI workflows under .github/workflows.

##### Architecture overview & main components
- **Component Modules** (Card, Form, Table, Layout, Field, List, Descriptions, Skeleton, Provider, Utils)
- **Build & Bundling** (father.js → outputs CommonJS / ES modules)
- **Documentation** (demos + site folder → Dumi → static site)
- **Testing** (Vitest/Jest → unit and snapshot reports)
- **CI/CD** (GitHub Actions → lint, test, coverage, publish)
- **Package Registry** (npm)

b. Relationships and data flow:
1. Developer commits code →
- Components in **src/**
- **scripts/** orchestrate pre-build tasks (e.g., code path fixes).
2. **Build & Bundling**
- father reads tsconfig, transpiles TS/JSX → lib/(cjs & es)
3. **Testing**
- tests run against built or source code → pass/fail
4. **Docs Site Generation**
- demos + Markdown under **site/** + Dumi config → build static docs
5. **CI/CD Pipeline**
- GitHub Actions run lint → test → coverage → if on main & tagged → publish to npm
6. **Consumers**
- External apps import from npm registry; consume ES or CJS builds and types

##### Architectural patterns & design principles
- **Modular, feature-based folder structure**
- **Single-responsibility components** (each folder = one component or utility)
- **Re-usable utilities & hooks** under utils and provider
- **Decoupled docs** via demos + markdown → maintain examples alongside code
- **Automated CI/CD** ensures quality and consistent releases

##### Essential details to capture
- All major src/** modules as separate component-library blocks
- Build pipeline (father config) feeding both dist/ and types/
- Docs pipeline chained from demos + markdown → Dumi
- CI/CD controlling test, coverage, and publish steps
- npm registry as end-point for consumers

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Source and Developer
    Dev["Developer"]:::external
    Dev -->|"commits code"| SourceCode

    subgraph "Source Repository"
        direction TB
        SourceCode[/"Git Repo"/]:::external

        subgraph "Source Code" 
            direction TB
            src_card["Card Module\n(src/card/)"]:::code
            src_desc["Descriptions Module\n(src/descriptions/)"]:::code
            src_field["Field Module\n(src/field/)"]:::code
            src_form["Form Module\n(src/form/)"]:::code
            src_layout["Layout Module\n(src/layout/)"]:::code
            src_list["List Module\n(src/list/)"]:::code
            src_provider["Provider Module\n(src/provider/)"]:::code
            src_skeleton["Skeleton Module\n(src/skeleton/)"]:::code
            src_table["Table Module\n(src/table/)"]:::code
            src_utils["Utils Module\n(src/utils/)"]:::code
        end

        scripts["Scripts\n(scripts/)"]:::tool

        demos["Documentation Demos\n(demos/)"]:::tool
        site_src["Doc Site Sources\n(site/)"]:::tool

        subgraph "Configuration"
            direction TB
            fatherrc["Build Config\n(.fatherrc.ts)"]:::tool
            dumirc_ts["Dumi Config\n(dumirc.ts)"]:::tool
            dot_dumi["Dumi Dir\n(.dumi/)"]:::tool
        end
    end

    %% Pipelines
    SourceCode -->|uses| scripts
    SourceCode -->|includes demos & site| demos
    SourceCode --> site_src
    scripts --> Build
    fatherrc --> Build

    subgraph "Build & Bundling" 
        direction TB
        Build["father.js → lib/ & es/"]:::tool
    end

    Build --> Test
    demos --> Docs
    site_src --> Docs
    dumirc_ts --> Docs
    dot_dumi --> Docs

    subgraph "Testing" 
        direction TB
        Test["Vitest/Jest\n(tests/)"]:::tool
    end

    subgraph "Documentation Generator"
        direction TB
        Docs["Dumi → static docs"]:::tool
    end

    subgraph "CI/CD Pipeline" 
        direction TB
        CI["GitHub Actions\n(.github/workflows/)"]:::ci
    end

    CI -->|on push/PR| scripts
    CI -->|runs| Build
    CI -->|runs| Test
    CI -->|runs| Docs
    CI -->|on main+tag| Publish

    subgraph "Registry & Consumption"
        direction TB
        NPM["npm Registry"]:::external
        Consumer["External Apps"]:::external
    end

    Publish --> NPM
    NPM -->|install| Consumer

    %% Click Events
    click src_card "https://github.com/ant-design/pro-components/tree/master/src/card/"
    click src_desc "https://github.com/ant-design/pro-components/tree/master/src/descriptions/"
    click src_field "https://github.com/ant-design/pro-components/tree/master/src/field/"
    click src_form "https://github.com/ant-design/pro-components/tree/master/src/form/"
    click src_layout "https://github.com/ant-design/pro-components/tree/master/src/layout/"
    click src_list "https://github.com/ant-design/pro-components/tree/master/src/list/"
    click src_provider "https://github.com/ant-design/pro-components/tree/master/src/provider/"
    click src_skeleton "https://github.com/ant-design/pro-components/tree/master/src/skeleton/"
    click src_table "https://github.com/ant-design/pro-components/tree/master/src/table/"
    click src_utils "https://github.com/ant-design/pro-components/tree/master/src/utils/"
    click fatherrc "https://github.com/ant-design/pro-components/blob/master/.fatherrc.ts"
    click dumirc_ts "https://github.com/ant-design/pro-components/blob/master/dumirc.ts"
    click dot_dumi "https://github.com/ant-design/pro-components/tree/master/.dumi/"
    click demos "https://github.com/ant-design/pro-components/tree/master/demos/"
    click site_src "https://github.com/ant-design/pro-components/tree/master/site/"
    click Test "https://github.com/ant-design/pro-components/tree/master/tests/"
    click CI "https://github.com/ant-design/pro-components/tree/master/.github/workflows/"

    %% Styles
    classDef code fill:#D0E6FF,stroke:#004080,color:#004080
    classDef tool fill:#FFE5B4,stroke:#C06000,color:#C06000
    classDef ci fill:#D4F5D4,stroke:#2E7D32,color:#2E7D32
    classDef external fill:#E0E0E0,stroke:#606060,color:#606060
```
