# harrysingh1999/harryshop architecture

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

- Interactive diagram: https://gitdiagram.com/harrysingh1999/harryshop
- Repository: https://github.com/harrysingh1999/harryshop

## Overview

##### Project type and purpose
- This is a single-page React application scaffolded with Vite.
- Purpose: an e-commerce front-end (products listing, cart, orders, wishlist, product details, search).
- No backend code in this repo—consumes external REST or GraphQL APIs via Redux Toolkit.

##### File structure
- Top-level files: configuration for ESLint, Tailwind, Vite, and package metadata.
- public/ folder holds static assets and redirect rules.
- src/ contains all source code:
- Components/ – presentational components organized by feature (Cart, Product, Header, Footer, etc.).
- Reduxtoolkit/ – slices and API setup for state and server interaction.
- utils/ – shared constants, images, and custom hooks.
- main.jsx & App.jsx – application entry point and root component.
- index.html & App.css – HTML template and global styles.
- Tailwind and PostCSS configurations drive styling.

##### README for additional insights
- Confirms Vite + React setup with HMR, ESLint rules, and official plugins for JSX support.

a. Main components to show:
- Browser/Client running React SPA
- React component hierarchy (App → Header, Home, Products, Cart, Orders, Product pages, Footer, etc.)
- Redux Toolkit store with slices: authSlice, cartSlice, wishlistSlice, apiSlice
- External API server(s) (products, cart, orders, auth endpoints)
- Static asset store/CDN (public images, favicon, redirect rules)
b. Relationships and interactions:
- User events in Components dispatch Redux actions → update store or trigger API calls via apiSlice.
- apiSlice middleware invokes HTTP requests → receives responses → dispatches fulfilled actions that update slices.
- Components subscribe to slice state (useSelector) and re-render with new data.
- Custom hooks (useOnlineStatus, useScroll) monitor environment and feed into components.
c. Architectural patterns and design principles:
- Component-driven design for UI (feature folders per component).
- Unidirectional data flow via Redux Toolkit (actions → reducers → state → view).
- Separation of concerns: presentation (Components/) vs. state & side-effects (Reduxtoolkit/) vs. utilities.
- Styling with Tailwind + PostCSS; bundling via Vite.
d. Key technologies and libraries:
- Vite (dev server, HMR, bundling)
- React 18 (function components, hooks)
- Redux Toolkit (createSlice, createApi)
- Tailwind CSS (utility-first styling)
- ESLint (code quality)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Browser and Build
    Browser["Browser / Client"]:::ext
    Vite["Vite Dev Server / Bundler"]:::config
    Browser -->|load index.html| IndexHTML
    IndexHTML["index.html"]:::asset
    IndexHTML -->|executes| MainJS
    MainJS["main.jsx"]:::config
    click MainJS "https://github.com/harrysingh1999/harryshop/blob/main/src/main.jsx"
    MainJS -->|renders| App
    App["App.jsx"]:::ui
    click App "https://github.com/harrysingh1999/harryshop/blob/main/src/App.jsx"
    App -->|imports styles| AppCSS
    AppCSS["App.css"]:::asset
    click AppCSS "https://github.com/harrysingh1999/harryshop/blob/main/src/App.css"

    %% UI Layer
    subgraph "UI Components" 
        direction TB
        App --> Header
        App --> Footer
        App --> HomePage
        App --> ProductsList
        App --> ProductDetails
        App --> CartPage
        App --> OrdersPage
        App --> WishlistPage
        App --> NotFound

        Header["Header"]:::ui
        click Header "https://github.com/harrysingh1999/harryshop/blob/main/src/Components/Header/Header.jsx"
        SearchBar["SearchBar"]:::ui
        click SearchBar "https://github.com/harrysingh1999/harryshop/blob/main/src/Components/Header/SearchBar.jsx"
        Header --> SearchBar

        Footer["Footer"]:::ui
        click Footer "https://github.com/harrysingh1999/harryshop/blob/main/src/Components/Footer/Footer.jsx"

        HomePage["Home"]:::ui
        click HomePage "https://github.com/harrysingh1999/harryshop/blob/main/src/Components/Home/Home.jsx"
        Banner["Banner"]:::ui
        click Banner "https://github.com/harrysingh1999/harryshop/blob/main/src/Components/Home/Banner.jsx"
        HomePage --> Banner

        ProductsList["Products Listing"]:::ui
        click ProductsList "https://github.com/harrysingh1999/harryshop/blob/main/src/Components/Products/Products.jsx"
        Filters["Filters"]:::ui
        click Filters "https://github.com/harrysingh1999/harryshop/blob/main/src/Components/Products/Filters.jsx"
        ProductsList --> Filters

        ProductDetails["Product Details"]:::ui
        click ProductDetails "https://github.com/harrysingh1999/harryshop/blob/main/src/Components/Product/Product.jsx"
        ProductCarousel["ProductCarousel"]:::ui
        click ProductCarousel "https://github.com/harrysingh1999/harryshop/blob/main/src/Components/Product/ProductCarousel.jsx"
        ProductReview["ProductReview"]:::ui
        click ProductReview "https://github.com/harrysingh1999/harryshop/blob/main/src/Components/Product/ProductReview.jsx"
        ProductDetails --> ProductCarousel
        ProductDetails --> ProductReview

        CartPage["Cart"]:::ui
        click CartPage "https://github.com/harrysingh1999/harryshop/blob/main/src/Components/Cart/Cart.jsx"
        CartTable["CartTable"]:::ui
        click CartTable "https://github.com/harrysingh1999/harryshop/blob/main/src/Components/Cart/CartTable.jsx"
        CartPage --> CartTable

        OrdersPage["Orders"]:::ui
        click OrdersPage "https://github.com/harrysingh1999/harryshop/blob/main/src/Components/Orders/Orders.jsx"
        OrderSummary["OrderSummary"]:::ui
        click OrderSummary "https://github.com/harrysingh1999/harryshop/blob/main/src/Components/OrderSummary/OrderSummary.jsx"
        OrdersPage --> OrderSummary

        WishlistPage["Wishlist"]:::ui
        click WishlistPage "https://github.com/harrysingh1999/harryshop/blob/main/src/Components/Wishlist/Wishlist.jsx"

        NotFound["404 NotFound"]:::ui
        click NotFound "https://github.com/harrysingh1999/harryshop/blob/main/src/Components/404/NotFoundPage.jsx"

        subgraph "Shared UI Primitives"
            direction TB
            ProductCard["ProductCard"]:::ui
            click ProductCard "https://github.com/harrysingh1999/harryshop/blob/main/src/Components/Card/ProductCard.jsx"
            CustomButton["CustomButton"]:::ui
            click CustomButton "https://github.com/harrysingh1999/harryshop/blob/main/src/Components/CustomButton/CustomButton.jsx"
            Snackbar["CustomSnackbar"]:::ui
            click Snackbar "https://github.com/harrysingh1999/harryshop/blob/main/src/Components/Snackbar/CustomSnackbar.jsx"
            Progress["Progress"]:::ui
            click Progress "https://github.com/harrysingh1999/harryshop/blob/main/src/Components/Progress/Progress.jsx"
            Ratings["Ratings"]:::ui
            click Ratings "https://github.com/harrysingh1999/harryshop/blob/main/src/Components/Ratings/Ratings.jsx"
            CompressedImage["CompressedImage"]:::ui
            click CompressedImage "https://github.com/harrysingh1999/harryshop/blob/main/src/Components/CompressedImage.jsx"
        end
    end

    %% State Management Layer
    subgraph "Redux Toolkit Store" 
        direction TB
        Store["Store"]:::state
        click Store "https://github.com/harrysingh1999/harryshop/blob/main/src/Reduxtoolkit/Store/store.js"
        AuthSlice["authSlice"]:::state
        click AuthSlice "https://github.com/harrysingh1999/harryshop/blob/main/src/Reduxtoolkit/authSlice/authSlice.js"
        CartSlice["cartSlice"]:::state
        click CartSlice "https://github.com/harrysingh1999/harryshop/blob/main/src/Reduxtoolkit/cartSlice/cartSlice.js"
        WishlistSlice["wishlistSlice"]:::state
        click WishlistSlice "https://github.com/harrysingh1999/harryshop/blob/main/src/Reduxtoolkit/wishlistSlice/wishlistSlice.js"
        APISlice["apiSlice"]:::data
        click APISlice "https://github.com/harrysingh1999/harryshop/blob/main/src/Reduxtoolkit/apiSlice/apiSlice.js"
        Store --> AuthSlice
        Store --> CartSlice
        Store --> WishlistSlice
        Store --> APISlice
    end

    %% Utilities
    subgraph "Utilities & Hooks" 
        direction TB
        Constants["constants.js"]:::util
        click Constants "https://github.com/harrysingh1999/harryshop/blob/main/src/utils/constants.js"
        Images["Images/"]:::asset
        click Images "https://github.com/harrysingh1999/harryshop/tree/main/src/utils/Images/"
        OnlineHook["useOnlineStatus"]:::util
        click OnlineHook "https://github.com/harrysingh1999/harryshop/blob/main/src/utils/customHooks/useOnlineStatus.js"
        ScrollHook["useScroll"]:::util
        click ScrollHook "https://github.com/harrysingh1999/harryshop/blob/main/src/utils/customHooks/useScroll.js"
    end

    %% Data Flow
    App -->|dispatch actions| Store
    Store -->|state via useSelector| App
    App -->|use hooks| Utilities
    APISlice -->|HTTP calls| ExternalAPI["External API"]:::ext
    ExternalAPI -->|responses| APISlice
    APISlice -->|updates| Store

    Assets["public/"]:::asset
    click Assets "https://github.com/harrysingh1999/harryshop/tree/main/public/"
    Redirects["_redirects"]:::asset
    click Redirects "https://github.com/harrysingh1999/harryshop/tree/main/public/_redirects"

    %% Config & Tooling
    subgraph "Project Configuration"
        direction TB
        ESLint[".eslintrc.cjs"]:::config
        TailwindConfig["tailwind.config.js"]:::config
        PostCSS["postcss.config.js"]:::config
        ViteConfig["vite.config.js"]:::config
        PackageJSON["package.json"]:::config
        LockFile["package-lock.json"]:::config
        Readme["README.md"]:::config
        Gitignore[".gitignore"]:::config
    end

    %% Styling
    IndexHTML -->|loads CSS| IndexCSS
    IndexCSS["index.css"]:::asset
    click IndexCSS "https://github.com/harrysingh1999/harryshop/blob/main/src/index.css"

    %% Styles
    classDef ui fill:#E3F2FD,stroke:#1E88E5,color:#0D47A1
    classDef state fill:#E8F5E9,stroke:#43A047,color:#1B5E20
    classDef data fill:#FFF3E0,stroke:#FB8C00,color:#E65100
    classDef ext fill:#F3E5F5,stroke:#8E24AA,color:#4A148C
    classDef util fill:#ECEFF1,stroke:#607D8B,color:#37474F
    classDef asset fill:#FFFDE7,stroke:#FDD835,color:#F57F17
    classDef config fill:#E0F7FA,stroke:#00ACC1,color:#006064
```
