# iamsuryasonar/apparel-store-limo architecture

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

- Interactive diagram: https://gitdiagram.com/iamsuryasonar/apparel-store-limo
- Repository: https://github.com/iamsuryasonar/apparel-store-limo

## Overview

##### Main Components
- User Interface Layer: This includes the core React components (in the src/components directory), page components (under src/pages), and layout elements like Nav, Footer, and various presentation components.
- State Management: The Redux store (in src/store) with various slices (authSlice, cartSlice, categorySlice, etc.) that manage application state and facilitate data consistency across the app.
- Service/API Layer: Services under src/services provide functionalities like authentication, cart actions, product fetching, order processing, and payment integration. These encapsulate external API calls and business logic.
- Routing & Navigation: React Router is used to organize the different pages and components, including protected routes (using auth_guards in src/components/auth_guards).
- Utility and Hooks Layer: Custom hooks (under src/hooks) encapsulate reusable logic (e.g., debouncing, pagination, lazy loading, window sizing) and utilities (from src/utilities) that improve code maintainability.

##### Relationships and Interactions
- The User Interface interacts with the Redux store to reflect current state (shopping cart updates, authentication, product lists, etc.) and trigger changes via user actions.
- Redux slices dispatch actions that result in asynchronous calls via the service layer. For example, when a user adds an item to the cart, a cart service is called, and the cartSlice updates the state.
- The Routing layer orchestrates which page or component is presented based on URL and authentication status (private vs. public routes).
- External APIs (like Razorpay for payments) are invoked through the service layer, ensuring secure transactions.
- Lazy loading (for both images and components) is implemented, as seen in both component and hooks structure, to optimize resource usage and improve performance.

##### Architectural Patterns & Design Principles
- Separation of Concerns: The project is modularized by separating presentation (React components/pages), state management (Redux store), business logic (services), and common utilities (hooks and constants).
- Component-Based Architecture: Each UI piece is encapsulated in its own component, promoting reusability (e.g., Carousels, Shimmers, Form elements).
- Clean UI/State Flow: The unidirectional data flow from React UI to Redux state and then to Services (APIs) ensures predictable behavior.
- Lazy Loading and Performance Optimizations: Emphasized in the project by loading components and images only as needed.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Browser / Client"]:::client
    B["React Framework (Vite)"]:::framework
    A --> B

    subgraph "User Interface Layer"
        C["Core React Components & Layouts"]:::ui
        D["Page Components"]:::ui
    end
    B --> C
    B --> D

    subgraph "Routing & Navigation"
        E["Nav & Outlet"]:::routing
        F["Auth Guards"]:::routing
    end
    C --> E
    C --> F
    D --> E
    D --> F

    subgraph "State Management (Redux)"
        G["Redux Store & Slices"]:::state
    end
    C --> G
    D --> G
    E --> G
    F --> G

    subgraph "Service/API Layer"
        H["Auth Service"]:::service
        I["Cart Service"]:::service
        J["Product Service"]:::service
        K["Order Service"]:::service
        M["Payment Service"]:::service
    end
    G --> H
    G --> I
    G --> J
    G --> K
    G --> M

    subgraph "Utilities & Hooks Layer"
        N["Custom Hooks"]:::utility
        O["Utilities"]:::utility
    end
    C --> N
    D --> N
    C --> O
    D --> O

    X["External Services (Razorpay, Sharp)"]:::external
    J --> X
    M --> X

    %% Click Events
    click C "https://github.com/iamsuryasonar/apparel-store-limo/tree/main/src/components"
    click D "https://github.com/iamsuryasonar/apparel-store-limo/tree/main/src/pages"
    click G "https://github.com/iamsuryasonar/apparel-store-limo/tree/main/src/store"
    click E "https://github.com/iamsuryasonar/apparel-store-limo/blob/main/src/components/NavAndOutlet.jsx"
    click F "https://github.com/iamsuryasonar/apparel-store-limo/tree/main/src/components/auth_guards"
    click H "https://github.com/iamsuryasonar/apparel-store-limo/blob/main/src/services/auth.services.js"
    click I "https://github.com/iamsuryasonar/apparel-store-limo/blob/main/src/services/cart.services.js"
    click J "https://github.com/iamsuryasonar/apparel-store-limo/blob/main/src/services/products.services.js"
    click K "https://github.com/iamsuryasonar/apparel-store-limo/blob/main/src/services/order.services.js"
    click M "https://github.com/iamsuryasonar/apparel-store-limo/blob/main/src/services/payment.services.js"
    click N "https://github.com/iamsuryasonar/apparel-store-limo/tree/main/src/hooks"
    click O "https://github.com/iamsuryasonar/apparel-store-limo/tree/main/src/utilities"

    %% Styles
    classDef client fill:#f9e79f,stroke:#7d6608,stroke-width:2px;
    classDef framework fill:#aed6f1,stroke:#21618c,stroke-width:2px;
    classDef ui fill:#d5f5e3,stroke:#196F3D,stroke-width:2px;
    classDef routing fill:#fadbd8,stroke:#922B21,stroke-width:2px;
    classDef state fill:#fcf3cf,stroke:#B7950B,stroke-width:2px;
    classDef service fill:#f9e79f,stroke:#9A7D0A,stroke-width:2px;
    classDef utility fill:#d6eaf8,stroke:#2874A6,stroke-width:2px;
    classDef external fill:#f5b7b1,stroke:#922B21,stroke-width:2px;
```
