# lequachtienb2014886/qcnb architecture

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

- Interactive diagram: https://gitdiagram.com/lequachtienb2014886/qcnb
- Repository: https://github.com/lequachtienb2014886/qcnb

## Overview

##### Main Components
- Environment & Deployment Configuration: Include components for the development (.env.development) and production (.env.production) environments, along with build/deployment files such as Dockerfile, Nginx configuration (nginx.conf, nginx/), and CI/CD configurations (.gitlab-ci.yml).
- Application Bootstrap & Entry: Represent the index.html and main.js (bootstrapping Vue) as the starting point for the client-side app.
- Routing & Navigation: Identify the router directory (src/router) which defines the client-side routing and navigation flows.
- Global State & Hooks: Include the state management (stores in src/stores) and the custom hooks (src/hooks) that interact with parts of the UI and possibly API endpoints.
- Views and Pages: Capture the primary UI views (src/views) such as Home.vue, Dashboard.vue.
- Reusable UI Components: Map out the various components found under src/components. Notice the grouping:
- Layout components (Header, Footer, Navbar) which structure the overall page.
- Domain-specific components related to Quality Control (e.g., QC components like LEANDPPM, QCQMB with embedded ECharts views, QCReport) and the DatePicker.
- Assets & Utilities: Include the assets (e.g., images or css under src/assets) and utility functions (src/util/formatDate.js) that support the UI rendering and processing.

##### Relationships and Interactions
- Data Flow: Show that the root Vue instance initializes via main.js, then passes through the router (navigation) and state management (stores) layers.
- Component Hierarchy: Illustrate how the Layout components (Header, Navbar, Footer) encapsulate the various views. Within some views (say Dashboard or Home), individual functional components (like DatePicker, QC components) are embedded.
- Dependency Flow: Capture the dependencies between components – for example, a QC Report view can include nested components managing defect data and search components.

##### Important Architectural Patterns and Design Principles
- Separation of Concerns: The project clearly distinguishes between UI components, state management, routing, and API handling via hooks.
- Reusability: The breakdown into multiple components and custom hooks shows a commitment to reusable and modular code.
- UI Composition: The use of Vue’s SFCs with the <script setup> is meant to simplify component architecture.
- Build and Deployment: The inclusion of Vite, Dockerfile, and Nginx configurations shows a clear separation between development tooling and production deployment environments.

##### Technologies, Frameworks, and Tools
- Vue 3 (using <script setup> SFCs) as the main framework.
- Vite as the development/build tool.
- Vue Router (src/router) for client-side navigation.
- State management using custom stores (possibly Vue’s reactivity system).
- ECharts embedded within QC components for visualizations.
- Docker and Nginx for containerized deployment and serving the application.

##### Elements
- Clear Labels: Name each component (e.g., “Main Vue Instance (main.js)”, “Router”, “Dashboard View”, “Layout Components”, “QC Components”, “Custom Hooks and API Layer”, “Environment & Deployment Config”).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Environment & Deployment Configuration
    subgraph "Environment & Deployment"
        e1[".env.development"]:::env
        e2[".env.production"]:::env
        e3["Dockerfile"]:::env
        e4["nginx.conf"]:::env
        e5["nginx/default.conf"]:::env
        e6[".gitlab-ci.yml"]:::env
    end

    %% Application Bootstrap & Entry
    subgraph "Application Bootstrap & Entry"
        b1["index.html"]:::bootstrap
        b2["src/main.js"]:::bootstrap
        b3["vite.config.js"]:::bootstrap
    end

    %% Vue Core Layer: Routing, Global State & Views
    subgraph "Vue Core"
        subgraph "Routing"
            r1["src/router/index.js"]:::vue
        end
        subgraph "Global State"
            s1["dashboardStore.js"]:::state
            s2["qcqmbEchartsStore.js"]:::state
        end
        subgraph "Views & Pages"
            v1["Home.vue"]:::view
            v2["Dashboard.vue"]:::view
        end
    end

    %% Reusable UI Components
    subgraph "Reusable UI Components"
        subgraph "Layout Components"
            l1["Header.vue"]:::comp
            l2["Footer.vue"]:::comp
            l3["Navbar.vue"]:::comp
        end
        subgraph "QC Components"
            q1["LEANDPPM.vue"]:::comp
            q2["QCQMB.vue"]:::comp
            subgraph "QC Report Components"
                q3["QCReport.vue"]:::comp
                q3e["QCReportECharts.vue"]:::comp
                q3s["QCReportSearch.vue"]:::comp
            end
        end
        subgraph "DatePicker Components"
            d1["DatePicker.vue"]:::comp
            d2["DatePicker_Comparison.vue"]:::comp
        end
    end

    %% Custom Hooks & API Interaction
    subgraph "Custom Hooks & API"
        h1["useLEANDPPM"]:::hook
        h2["useQCQMB"]:::hook
        h3["useQCReport"]:::hook
        h4["useNavbar_API.js"]:::hook
    end

    %% Assets & Utilities
    subgraph "Assets & Utilities"
        a1["Assets"]:::asset
        a2["formatDate.js"]:::asset
    end

    %% Data Flow / Relationships
    %% Environment influences Bootstrap
    e3 --> b2
    e1 --> b2
    e2 --> b2
    e4 --> b2
    e5 --> b2
    e6 --> b2

    %% Bootstrap initializes the Vue application
    b2 --> r1
    b2 --> s1
    b2 --> s2

    %% Routing directs to Views
    r1 --> v1
    r1 --> v2

    %% Global State provides data to Views & Pages
    s1 --> v2
    s2 --> v2

    %% Views compose UI using Layout and other Components
    v1 --> l1
    v1 --> l2
    v1 --> l3

    v2 --> l1
    v2 --> l2
    v2 --> l3
    v2 --> q1
    v2 --> q2
    v2 --> q3
    v2 --> d1
    v2 --> d2

    %% QC Report Components breakdown
    q3 --> q3e
    q3 --> q3s

    %% Custom Hooks interact with respective components
    h1 --> q1
    h2 --> q2
    h3 --> q3
    h4 --> l3

    %% Assets & Utilities support Views
    a1 --> v1
    a1 --> v2
    a2 --> v1
    a2 --> v2

    %% Styling Classes
    classDef env fill:#b3cde0,stroke:#005b96,stroke-width:2px,color:#000;
    classDef bootstrap fill:#ccebc5,stroke:#2b8c00,stroke-width:2px,color:#000;
    classDef vue fill:#decbe4,stroke:#8856a7,stroke-width:2px,color:#000;
    classDef state fill:#fed9a6,stroke:#e6550d,stroke-width:2px,color:#000;
    classDef view fill:#fddaec,stroke:#dd1c77,stroke-width:2px,color:#000;
    classDef comp fill:#ffffcc,stroke:#999900,stroke-width:2px,color:#000;
    classDef hook fill:#f2f2f2,stroke:#b3b3b3,stroke-width:2px,color:#000;
    classDef asset fill:#d9f2d9,stroke:#66a366,stroke-width:2px,color:#000;

    %% Click Events for Environment & Deployment
    click e1 "https://github.com/lequachtienb2014886/qcnb/blob/main/.env.development"
    click e2 "https://github.com/lequachtienb2014886/qcnb/blob/main/.env.production"
    click e3 "https://github.com/lequachtienb2014886/qcnb/tree/main/Dockerfile"
    click e4 "https://github.com/lequachtienb2014886/qcnb/blob/main/nginx.conf"
    click e5 "https://github.com/lequachtienb2014886/qcnb/blob/main/nginx/default.conf"
    click e6 "https://github.com/lequachtienb2014886/qcnb/blob/main/.gitlab-ci.yml"

    %% Click Events for Application Bootstrap & Entry
    click b1 "https://github.com/lequachtienb2014886/qcnb/blob/main/index.html"
    click b2 "https://github.com/lequachtienb2014886/qcnb/blob/main/src/main.js"
    click b3 "https://github.com/lequachtienb2014886/qcnb/blob/main/vite.config.js"

    %% Click Event for Routing
    click r1 "https://github.com/lequachtienb2014886/qcnb/blob/main/src/router/index.js"

    %% Click Events for Global State & Stores
    click s1 "https://github.com/lequachtienb2014886/qcnb/blob/main/src/stores/dashboardStore.js"
    click s2 "https://github.com/lequachtienb2014886/qcnb/blob/main/src/stores/qcqmbEchartsStore.js"

    %% Click Events for Views & Pages
    click v1 "https://github.com/lequachtienb2014886/qcnb/blob/main/src/views/Home.vue"
    click v2 "https://github.com/lequachtienb2014886/qcnb/blob/main/src/views/Dashboard.vue"

    %% Click Events for Layout Components
    click l1 "https://github.com/lequachtienb2014886/qcnb/blob/main/src/components/Layout/Header.vue"
    click l2 "https://github.com/lequachtienb2014886/qcnb/blob/main/src/components/Layout/Footer.vue"
    click l3 "https://github.com/lequachtienb2014886/qcnb/blob/main/src/components/Layout/Navbar.vue"

    %% Click Events for QC Components
    click q1 "https://github.com/lequachtienb2014886/qcnb/blob/main/src/components/QC/LEANDPPM/LEANDPPM.vue"
    click q2 "https://github.com/lequachtienb2014886/qcnb/blob/main/src/components/QC/QCQMB/QCQMB.vue"
    click q3 "https://github.com/lequachtienb2014886/qcnb/blob/main/src/components/QC/QCReport/QCReport.vue"
    click q3e "https://github.com/lequachtienb2014886/qcnb/blob/main/src/components/QC/QCReport/QCReportECharts.vue"
    click q3s "https://github.com/lequachtienb2014886/qcnb/blob/main/src/components/QC/QCReport/QCReportSearch.vue"

    %% Click Events for DatePicker Components
    click d1 "https://github.com/lequachtienb2014886/qcnb/blob/main/src/components/DatePicker/DatePicker.vue"
    click d2 "https://github.com/lequachtienb2014886/qcnb/blob/main/src/components/DatePicker/DatePicker_Comparison.vue"

    %% Click Events for Custom Hooks & API Interaction
    click h1 "https://github.com/lequachtienb2014886/qcnb/tree/main/src/hooks/useLEANDPPM"
    click h2 "https://github.com/lequachtienb2014886/qcnb/tree/main/src/hooks/useQCQMB"
    click h3 "https://github.com/lequachtienb2014886/qcnb/tree/main/src/hooks/useQCReport"
    click h4 "https://github.com/lequachtienb2014886/qcnb/blob/main/src/hooks/useNavbar_API.js"

    %% Click Events for Assets & Utilities
    click a1 "https://github.com/lequachtienb2014886/qcnb/tree/main/src/assets"
    click a2 "https://github.com/lequachtienb2014886/qcnb/blob/main/src/util/formatDate.js"
```
