# sofardy/wiut-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/sofardy/wiut-frontend
- Repository: https://github.com/sofardy/wiut-frontend

## Overview

##### Project type and purpose
- This is a single-page application (SPA) built with React (bootstrapped via Create React App).
- Its folder structure, “src/components,” “src/pages,” “src/routers,” etc., plus asset folders for styles, images, fonts, indicates a client-side e-commerce or product-display application.

##### File structure
- Top-level directories:
- public – static index.html, manifest.json, robots.txt
- src – all application source code
- build – production output (HTML, CSS, JS bundles, assets)
- Within src:
- assets – fonts, images, global & abstract SCSS/CSS
- components – reusable UI pieces (headers, product cards, sidebars)
- layouts – wrappers for admin, client, or no-layout pages
- pages – entry-point components wired to routes
- routers – React Router setup and middleware
- hooks – custom React hooks
- Config/build scripts:
- package.json – dev and prod dependencies, scripts (start/test/build)
- webpack/babel hidden under CRA (ejected or abstracted).

##### Insights from the README
- Standard CRA commands: start, test, build, eject.
- Nothing custom beyond default – no server code here, purely front end.

##### Detailed but focused
- Build pipeline: npm scripts → CRA webpack → build/ folder → deployment target.
- Every significant architectural element to help new engineers understand the code structure, data flow, and deployment model at a glance.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Hosting Layer
    subgraph "Hosting Layer" 
        direction TB
        Browser["User's Web Browser"]:::external
        CDN["Static File Host (CDN/Web Server)"]:::assets
        Browser -->|"HTTP GET index.html"| CDN
    end

    %% Build Pipeline
    subgraph "Build Pipeline" 
        direction TB
        NPM["npm scripts (start/test/build)"]:::pipeline
        CRA["CRA (webpack/Babel)"]:::pipeline
        BuildFolder["build/ (production output)"]:::assets
        NPM -->|"runs"| CRA
        CRA -->|"generates"| BuildFolder
        BuildFolder --> CDN
    end

    %% React Application
    subgraph "React SPA" 
        direction TB
        RouterLayer["Router Layer"]:::ui
        subgraph "Layouts"
            direction TB
            AdminLayout["AdminLayout"]:::ui
            ClientLayout["ClientLayout"]:::ui
            NoneLayout["NoLayout"]:::ui
        end
        subgraph "Pages"
            direction TB
            MainPage["MainPage"]:::ui
            SelectedProductsPage["SelectedProductsPage"]:::ui
            NotFoundPage["NotFound (404)"]:::ui
        end
        subgraph "UI Components"
            direction TB
            Header["Header"]:::ui
            Sidebar["Mobile Sidebar"]:::ui
            ProductCard["ProductCard"]:::ui
            SelectedProductsUI["SelectedProducts UI"]:::ui
            CategoryProductsUI["CategoryProducts UI"]:::ui
            CheapProductsUI["CheapProducts UI"]:::ui
            OfferProductsUI["OfferProducts UI"]:::ui
            PopularProductsUI["PopularProducts UI"]:::ui
            Discounts["Discounts"]:::ui
            SearchResults["SearchResults"]:::ui
            Stores["Stores"]:::ui
            AboutApp["AboutApp"]:::ui
            MainUI["Main UI"]:::ui
            subgraph "ViewProduct Components"
                direction TB
                ViewProduct["ViewProduct"]:::ui
                AboutProduct["AboutProduct"]:::ui
                CollapseProduct["CollapseProduct"]:::ui
                Statistics["Statistics"]:::ui
            end
        end
        subgraph "Logic & Data Flow"
            direction TB
            Hooks["Custom Hooks"]:::data
        end
        subgraph "Assets"
            direction TB
            Styles["Global & Abstract Styles"]:::assets
            Fonts["Fonts"]:::assets
            Images["Images"]:::assets
        end

        CDN -->|"loads JS/CSS bundles"| RouterLayer
        RouterLayer -->|"routes to"| Layouts
        Layouts -->|"wraps"| Pages
        Pages -->|"renders"| UI_Components[(UI Components)]
        UI_Components -->|"use"| Hooks
        Hooks -->|"fetch()/axios"| ExternalServices
        ExternalServices -->|"returns data"| UI_Components

    end

    ExternalServices["External Service(s)"]:::external

    %% Click Events
    click RouterLayer "https://github.com/sofardy/wiut-frontend/blob/main/src/routers/index.js"
    click RouterLayer "https://github.com/sofardy/wiut-frontend/blob/main/src/routers/routerMiddleware.js"
    click AdminLayout "https://github.com/sofardy/wiut-frontend/blob/main/src/layouts/adminLayout/index.jsx"
    click ClientLayout "https://github.com/sofardy/wiut-frontend/blob/main/src/layouts/clientLayout/index.jsx"
    click NoneLayout "https://github.com/sofardy/wiut-frontend/blob/main/src/layouts/noneLayout/index.jsx"
    click MainPage "https://github.com/sofardy/wiut-frontend/blob/main/src/pages/mainPage.jsx"
    click SelectedProductsPage "https://github.com/sofardy/wiut-frontend/blob/main/src/pages/selectedProducts.jsx"
    click NotFoundPage "https://github.com/sofardy/wiut-frontend/blob/main/src/components/notFound/index.jsx"
    click Header "https://github.com/sofardy/wiut-frontend/blob/main/src/components/header/index.jsx"
    click Header "https://github.com/sofardy/wiut-frontend/blob/main/src/components/header/style.scss"
    click Sidebar "https://github.com/sofardy/wiut-frontend/blob/main/src/components/sidebars/mobileSidebar.jsx"
    click Sidebar "https://github.com/sofardy/wiut-frontend/blob/main/src/components/sidebars/mobSibebarStyle.scss"
    click ProductCard "https://github.com/sofardy/wiut-frontend/blob/main/src/components/productCard/index.jsx"
    click SelectedProductsUI "https://github.com/sofardy/wiut-frontend/blob/main/src/components/selectedProducts/index.jsx"
    click CategoryProductsUI "https://github.com/sofardy/wiut-frontend/blob/main/src/components/categoryProducts/index.jsx"
    click CheapProductsUI "https://github.com/sofardy/wiut-frontend/blob/main/src/components/cheapProducts/index.jsx"
    click OfferProductsUI "https://github.com/sofardy/wiut-frontend/blob/main/src/components/offerProducts/index.jsx"
    click PopularProductsUI "https://github.com/sofardy/wiut-frontend/blob/main/src/components/popularProducts/index.jsx"
    click Discounts "https://github.com/sofardy/wiut-frontend/blob/main/src/components/discounts/index.jsx"
    click Discounts "https://github.com/sofardy/wiut-frontend/blob/main/src/components/discounts/style.scss"
    click SearchResults "https://github.com/sofardy/wiut-frontend/blob/main/src/components/searchResult/index.jsx"
    click SearchResults "https://github.com/sofardy/wiut-frontend/blob/main/src/components/searchResult/style.scss"
    click Stores "https://github.com/sofardy/wiut-frontend/blob/main/src/components/stores/index.jsx"
    click Stores "https://github.com/sofardy/wiut-frontend/blob/main/src/components/stores/style.scss"
    click AboutApp "https://github.com/sofardy/wiut-frontend/blob/main/src/components/aboutApp/index.jsx"
    click AboutApp "https://github.com/sofardy/wiut-frontend/blob/main/src/components/aboutApp/style.scss"
    click MainUI "https://github.com/sofardy/wiut-frontend/blob/main/src/components/main/index.jsx"
    click MainUI "https://github.com/sofardy/wiut-frontend/blob/main/src/components/main/style.scss"
    click ViewProduct "https://github.com/sofardy/wiut-frontend/blob/main/src/components/viewProduct/index.jsx"
    click AboutProduct "https://github.com/sofardy/wiut-frontend/blob/main/src/components/viewProduct/aboutPtroduct.jsx"
    click CollapseProduct "https://github.com/sofardy/wiut-frontend/blob/main/src/components/viewProduct/collapseProduct.jsx"
    click Statistics "https://github.com/sofardy/wiut-frontend/blob/main/src/components/viewProduct/statistics.jsx"
    click Hooks "https://github.com/sofardy/wiut-frontend/blob/main/src/hooks/useDebounse.js"
    click Hooks "https://github.com/sofardy/wiut-frontend/blob/main/src/hooks/useScrollTop.js"
    click Hooks "https://github.com/sofardy/wiut-frontend/blob/main/src/hooks/useWindowSize.js"
    click Styles "https://github.com/sofardy/wiut-frontend/blob/main/src/assets/styles/globalStyles.scss"
    click Styles "https://github.com/sofardy/wiut-frontend/blob/main/src/assets/styles/main.scss"
    click Styles "https://github.com/sofardy/wiut-frontend/blob/main/src/assets/styles/abstracts/_variables.scss"
    click Styles "https://github.com/sofardy/wiut-frontend/blob/main/src/assets/styles/abstracts/_mixins.scss"
    click Styles "https://github.com/sofardy/wiut-frontend/blob/main/src/assets/styles/abstracts/_fontImports.scss"
    click Fonts "https://github.com/sofardy/wiut-frontend/tree/main/src/assets/fonts/"
    click Images "https://github.com/sofardy/wiut-frontend/tree/main/src/assets/images/"

    %% Styles
    classDef ui fill:#cce5ff,stroke:#004085,color:#004085;
    classDef data fill:#d4edda,stroke:#155724,color:#155724;
    classDef assets fill:#e2e3e5,stroke:#6c757d,color:#6c757d;
    classDef external fill:#f8d7da,stroke:#721c24,stroke-dasharray: 5 5,color:#721c24;
    classDef pipeline fill:#fff3cd,stroke:#856404,color:#856404;
```
