# nguyen1976/shopee_clone architecture

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

- Interactive diagram: https://gitdiagram.com/nguyen1976/shopee_clone
- Repository: https://github.com/nguyen1976/shopee_clone

## Overview

##### Main Architecture Components

A. Frontend Layer (React Application)
- As the topmost layer with these key components:
- Pages (User & Admin sections)
- Components
- Layouts
- Context Providers
- Redux Store

B. State Management & Business Logic Layer
- Redux Store with slices (Product, Order, User)
- Context Providers (Order, Toast, User)
- Hooks (useDebounce)

C. Services Layer
- API Services:
- UserService
- ProductService
- OrderService
- AddressService
- PaymentService
- VisitService
- ShipEngine API Integration
- Cloudinary Integration (for image handling)

##### Component Organization

**Layouts**
- AdminLayout
- UserLayout
- DefaultLayout
- AccessLayout
- FooterLayout

**Components**
- Core Components (Modal, Loading, Toast, etc.)
- Feature Components (CardProduct, Header, Footer, etc.)

**Pages**
- Admin Section
- Products
- Orders
- Users
- User Section
- Home
- Product Details
- Payment
- Orders
- Profile

##### Data Flow Visualization

- User interactions → Components
- Components → Redux Actions
- Redux Actions → Services
- Services → External APIs
- API Responses → Redux Store
- Store Updates → Component Re-renders

##### Integration Points

Key integration points:
- ShipEngine API for shipping functionality
- Cloudinary for image management
- Authentication/Authorization flows
- Payment processing
- Address management

##### Technical Stack Indicators

- React
- Redux
- Tailwind CSS
- Axios
- JWT handling

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Frontend
        Pages["Pages"]
        Components["Components"]
        Layouts["Layouts"]
        ContextProviders["Context Providers"]
    end

    subgraph StateManagement
        ReduxStore["Redux Store"]:::redux
        UserSlice["User Slice"]:::redux
        ProductSlice["Product Slice"]:::redux
        OrderSlice["Order Slice"]:::redux
    end

    subgraph ServiceLayer
        UserService["User Service"]:::service
        ProductService["Product Service"]:::service
        OrderService["Order Service"]:::service
        AddressService["Address Service"]:::service
        PaymentService["Payment Service"]:::service
        VisitService["Visit Service"]:::service
    end

    subgraph ExternalServices
        ShipEngine["ShipEngine API"]:::external
        Cloudinary["Cloudinary"]:::external
    end

    subgraph Layouts
        DefaultLayout["Default Layout"]:::layout
        AdminLayout["Admin Layout"]:::layout
        UserLayout["User Layout"]:::layout
        AccessLayout["Access Layout"]:::layout
        HeaderLayout["Header Layout"]:::layout
        FooterLayout["Footer Layout"]:::layout
    end

    subgraph Components
        ToastSystem["Toast System"]:::component
        ModalSystem["Modal System"]:::component
        LoadingStates["Loading States"]:::component
        ImageHandling["Image Handling"]:::component
        FormInputs["Form Inputs"]:::component
        Header["Header"]:::component
        Footer["Footer"]:::component
        ProductCard["Product Card"]:::component
    end

    subgraph ContextProviders
        UserContext["User Context"]:::context
        OrderContext["Order Context"]:::context
        ToastContext["Toast Context"]:::context
    end

    %% Relationships
    Pages --> ReduxStore
    Components --> ReduxStore
    ReduxStore --> UserSlice
    ReduxStore --> ProductSlice
    ReduxStore --> OrderSlice
    
    UserSlice --> UserService
    ProductSlice --> ProductService
    OrderSlice --> OrderService
    
    OrderService --> ShipEngine
    ImageHandling --> Cloudinary
    
    ContextProviders --> Components
    Layouts --> Components

    %% Click Events
    click Pages "https://github.com/Nguyen1976/Shopee_Clone/tree/main/src/pages"
    click ReduxStore "https://github.com/Nguyen1976/Shopee_Clone/blob/main/src/redux/store.js"
    click UserSlice "https://github.com/Nguyen1976/Shopee_Clone/blob/main/src/redux/slices/UserSlice.js"
    click ProductSlice "https://github.com/Nguyen1976/Shopee_Clone/blob/main/src/redux/slices/ProductSlice.js"
    click OrderSlice "https://github.com/Nguyen1976/Shopee_Clone/blob/main/src/redux/slices/OrderSlice.js"
    click UserService "https://github.com/Nguyen1976/Shopee_Clone/blob/main/src/services/UserService.js"
    click ProductService "https://github.com/Nguyen1976/Shopee_Clone/blob/main/src/services/ProductService.js"
    click OrderService "https://github.com/Nguyen1976/Shopee_Clone/blob/main/src/services/OrderService.js"
    click AddressService "https://github.com/Nguyen1976/Shopee_Clone/blob/main/src/services/AddressService.js"
    click PaymentService "https://github.com/Nguyen1976/Shopee_Clone/blob/main/src/services/PaymentService.js"
    click VisitService "https://github.com/Nguyen1976/Shopee_Clone/blob/main/src/services/VisitService.js"
    click UserContext "https://github.com/Nguyen1976/Shopee_Clone/blob/main/src/context/UserContext/UserContext.jsx"
    click OrderContext "https://github.com/Nguyen1976/Shopee_Clone/blob/main/src/context/OrderContext/OrderContext.jsx"
    click ToastContext "https://github.com/Nguyen1976/Shopee_Clone/blob/main/src/context/ToastContext/ToastContext.jsx"
    click DefaultLayout "https://github.com/Nguyen1976/Shopee_Clone/blob/main/src/layouts/DefaultLayout/DefaultLayout.jsx"
    click AdminLayout "https://github.com/Nguyen1976/Shopee_Clone/blob/main/src/layouts/AdminLayout/AdminLayout.jsx"
    click UserLayout "https://github.com/Nguyen1976/Shopee_Clone/blob/main/src/layouts/UserLayout/UserLayout.jsx"
    click AccessLayout "https://github.com/Nguyen1976/Shopee_Clone/blob/main/src/layouts/AccessLayout/AccessLayout.jsx"
    click HeaderLayout "https://github.com/Nguyen1976/Shopee_Clone/blob/main/src/layouts/HeaderLayout/HeaderLayout.jsx"
    click FooterLayout "https://github.com/Nguyen1976/Shopee_Clone/blob/main/src/layouts/FooterLayout/FooterLayout.jsx"
    click ToastSystem "https://github.com/Nguyen1976/Shopee_Clone/tree/main/src/components/ToastMessage"
    click ModalSystem "https://github.com/Nguyen1976/Shopee_Clone/tree/main/src/components/Modal"
    click LoadingStates "https://github.com/Nguyen1976/Shopee_Clone/tree/main/src/components/Loading"
    click ImageHandling "https://github.com/Nguyen1976/Shopee_Clone/tree/main/src/components/Image"
    click FormInputs "https://github.com/Nguyen1976/Shopee_Clone/tree/main/src/components/InputForm"
    click Header "https://github.com/Nguyen1976/Shopee_Clone/blob/main/src/components/Header/Header.jsx"
    click Footer "https://github.com/Nguyen1976/Shopee_Clone/blob/main/src/components/Footer/Footer.jsx"
    click ProductCard "https://github.com/Nguyen1976/Shopee_Clone/blob/main/src/components/CardProduct/CardProduct.jsx"

    %% Styles
    classDef frontend fill:#2196F3,color:white
    classDef redux fill:#764ABC,color:white
    classDef service fill:#4CAF50,color:white
    classDef external fill:#FFC107,color:black
    classDef layout fill:#9C27B0,color:white
    classDef component fill:#03A9F4,color:white
    classDef context fill:#FF5722,color:white

    %% Legend
    subgraph Legend
        Frontend_L["Frontend"]:::frontend
        Redux_L["Redux"]:::redux
        Service_L["Service"]:::service
        External_L["External"]:::external
        Layout_L["Layout"]:::layout
        Component_L["Component"]:::component
        Context_L["Context"]:::context
    end
```
