# minurte1/cn_da21tta_hohoangphuc_shoes2 architecture

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

- Interactive diagram: https://gitdiagram.com/minurte1/cn_da21tta_hohoangphuc_shoes2
- Repository: https://github.com/minurte1/cn_da21tta_hohoangphuc_shoes2

## Overview

##### High-Level Architecture Components

a) Frontend Layer (React Application):
- User View (web-view)
- Admin View (admin-view)
- User Dashboard (user-view)
- Shared Components (share-view)

b) Backend Layer (Node.js):
- API Controllers (categorized by domain)
- Authentication/Authorization
- File Upload Service
- Real-time Communication (Socket.IO)

c) Database Layer:
- MySQL database with main entities
- ERD relationships (as indicated by the ERD files in the database folder)

##### Key Interactions to Highlight

- REST API calls between Frontend and Backend
- WebSocket connections for real-time features
- Database queries and transactions
- External service integrations (Payment gateways - MoMo, VNPay)

##### Specific Components to Detail

Product Management:
**[Frontend] -> [Product Controllers] -> [Database]**
- ↓
**[Category Management]**
**[Inventory Management]**
**[Product Search/Filter]**

User Interactions:
**[Authentication] -> [JWT Service]**
**[Shopping Cart] -> [Order Processing]**
**[Real-time Chat] -> [Socket.IO]**

Payment Processing:
**[Checkout] -> [Payment Gateway]**
- ↓
**[Order Management]**
**[Transaction Processing]**

##### Additional Elements

Include:
- Load balancers (if applicable)
- Caching layers
- File storage for images
- Security layers (JWT, middleware)

##### Notes for Implementation

- Microservices architecture (separate services for products, users, orders)
- Real-time features (chat, notifications)
- Security implementation (JWT tokens)
- Scalability points
- Integration points with external services

##### Technical Stack Callouts

Technologies:
- Frontend: React.js, Material-UI, Redux Toolkit
- Backend: Node.js, Express.js
- Database: MySQL
- Real-time: Socket.IO
- Authentication: JWT
- State Management: Redux

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        UI[Frontend Application]
        WV["Web View"]
        AV["Admin View"]
        UD["User Dashboard"]
        SC["Shared Components"]
        UI --> WV & AV & UD & SC
        
        subgraph PaymentUI
            MoMo["MoMo Payment"]
            VNPay["VNPay Payment"]
        end
        
        subgraph StateManagement
            Redux["Redux Store"]
            AuthSlice["Auth Slice"]
            Redux --> AuthSlice
        end
        
        Chat["Real-time Chat"]
    end
    
    subgraph Backend
        API["API Services"]
        
        subgraph Controllers
            PC["Product Management"]
            UC["User Management"]
            PP["Payment Processing"]
            UI_C["User Interactions"]
            MC["Message Controller"]
        end
        
        subgraph Security
            JWT["JWT Service"]
            Auth["Authentication"]
            JWT --> Auth
        end
        
        FileUpload["File Upload Service"]
        Socket["Socket.IO Server"]
    end
    
    subgraph Database
        MySQL[(MySQL Database)]
        ERD["ERD Models"]
        Schema["Database Schema"]
        MySQL --> ERD
        MySQL --> Schema
    end
    
    %% Connections
    UI --> API
    Chat --> Socket
    Socket --> MC
    API --> Controllers
    Controllers --> MySQL
    Auth --> JWT
    
    %% External Services
    PaymentGW["Payment Gateways"]
    MoMo & VNPay --> PaymentGW
    PaymentGW --> PP
    
    %% Styles
    classDef frontend fill:#2196F3,color:white
    classDef backend fill:#4CAF50,color:white
    classDef database fill:#FFC107,color:black
    classDef security fill:#9C27B0,color:white
    classDef external fill:#F44336,color:white
    
    class UI,WV,AV,UD,SC,MoMo,VNPay,Redux,AuthSlice,Chat frontend
    class API,PC,UC,PP,UI_C,MC,FileUpload,Socket backend
    class MySQL,ERD,Schema database
    class JWT,Auth security
    class PaymentGW external
    
    %% Click Events
    click WV "https://github.com/Minurte1/CN_DA21TTA_HoHoangPhuc_Shoes2/tree/main/react-phucshoe2/src/web-view/"
    click AV "https://github.com/Minurte1/CN_DA21TTA_HoHoangPhuc_Shoes2/tree/main/react-phucshoe2/src/admin-view/"
    click UD "https://github.com/Minurte1/CN_DA21TTA_HoHoangPhuc_Shoes2/tree/main/react-phucshoe2/src/user-view/"
    click SC "https://github.com/Minurte1/CN_DA21TTA_HoHoangPhuc_Shoes2/tree/main/react-phucshoe2/src/share-view/"
    click PC "https://github.com/Minurte1/CN_DA21TTA_HoHoangPhuc_Shoes2/tree/main/node-phucshoe2/src/controllers/sanPhamController/"
    click UC "https://github.com/Minurte1/CN_DA21TTA_HoHoangPhuc_Shoes2/tree/main/node-phucshoe2/src/controllers/nguoiDungController/"
    click PP "https://github.com/Minurte1/CN_DA21TTA_HoHoangPhuc_Shoes2/tree/main/node-phucshoe2/src/controllers/thanhToanController/"
    click UI_C "https://github.com/Minurte1/CN_DA21TTA_HoHoangPhuc_Shoes2/tree/main/node-phucshoe2/src/controllers/tuongTacUserController/"
    click JWT "https://github.com/Minurte1/CN_DA21TTA_HoHoangPhuc_Shoes2/blob/main/node-phucshoe2/src/middleware/JWTaction.js"
    click Auth "https://github.com/Minurte1/CN_DA21TTA_HoHoangPhuc_Shoes2/tree/main/react-phucshoe2/src/authentication/"
    click Chat "https://github.com/Minurte1/CN_DA21TTA_HoHoangPhuc_Shoes2/tree/main/react-phucshoe2/src/web-view/component-view/ComponentChat/"
    click MC "https://github.com/Minurte1/CN_DA21TTA_HoHoangPhuc_Shoes2/blob/main/node-phucshoe2/src/controllers/nguoiDungController/tinNhanController.js"
    click ERD "https://github.com/Minurte1/CN_DA21TTA_HoHoangPhuc_Shoes2/tree/main/database/ERD/"
    click Schema "https://github.com/Minurte1/CN_DA21TTA_HoHoangPhuc_Shoes2/blob/main/database/PhucShoe2_11_12_2024.sql"
    click FileUpload "https://github.com/Minurte1/CN_DA21TTA_HoHoangPhuc_Shoes2/blob/main/node-phucshoe2/src/config/multerConfig.js"
    click MoMo "https://github.com/Minurte1/CN_DA21TTA_HoHoangPhuc_Shoes2/blob/main/react-phucshoe2/src/web-view/component-view/thanhToanMoMo.jsx"
    click VNPay "https://github.com/Minurte1/CN_DA21TTA_HoHoangPhuc_Shoes2/blob/main/react-phucshoe2/src/web-view/component-view/checkOutVnPay.jsx"
    click Redux "https://github.com/Minurte1/CN_DA21TTA_HoHoangPhuc_Shoes2/blob/main/react-phucshoe2/src/redux/store.js"
    click AuthSlice "https://github.com/Minurte1/CN_DA21TTA_HoHoangPhuc_Shoes2/blob/main/react-phucshoe2/src/redux/authSlice.js"
```
