# shubham08pr/flipkart-clone-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/shubham08pr/flipkart-clone-frontend
- Repository: https://github.com/shubham08pr/flipkart-clone-frontend

## Overview

##### Project type and purpose
- This is a single-page, full-stack front-end application built with React (bootstrapped via Create React App).
- It implements an e-commerce style UI with product listing, detail pages, cart functionality, and user login.
- State management is handled by Redux (with two reducers: `productReducer` and `cartReducer`), supplemented by a React Context (`DataProvider`) for any shared data.

##### File structure
- Top-level folders:
- public – static HTML, manifest, robots.txt
- src – all application code
· components – UI split into domain modules (home, header, detail, cart, login)
· redux – actions, constants, reducers, store configuration
· context – a DataProvider wrapper
· service – `api.js` for HTTP calls
· utils & constants – helper functions and static data
- Configuration/build scripts are implicitly managed by CRA (no custom webpack config)
- No backend code—this is purely a front-end that calls out to an external API via `service/api.js`.

##### README for additional insights
- Standard CRA instructions—no custom architecture docs
- Deployment target is a static build (`npm run build`) served by any HTTP server or CDN

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Browser / Hosting Layer
    subgraph "Browser & Hosting"
        Public["public/index.html"]:::static
        Index["src/index.js"]:::frontend
        App["src/App.js"]:::frontend
    end

    %% Presentation Layer
    subgraph "Presentation Layer" 
        HomeModule["Home Module"]:::frontend
        HeaderModule["Header Module"]:::frontend
        DetailModule["Detail Module"]:::frontend
        CartModule["Cart Module"]:::frontend
        LoginModule["Login Module"]:::frontend
    end

    %% State Management Layer
    subgraph "State Management Layer"
        Store["Redux Store<br/>(cartReducer, productReducer)"]:::state
        ProductActions["Product Actions"]:::state
        CartActions["Cart Actions"]:::state
        ProductConstants["Product Constants"]:::state
        CartConstants["Cart Constants"]:::state
        ProductReducer["Product Reducer"]:::state
        CartReducer["Cart Reducer"]:::state
        Context["DataProvider (Context)"]:::state
    end

    %% Service Layer
    subgraph "Service Layer"
        APIClient["src/service/api.js"]:::service
    end

    %% External API
    ExternalAPI["External REST API"]:::external

    %% Utility Modules
    subgraph "Utilities"
        Utils["src/utils/common-utils.js"]:::service
        DataConst["src/constants/Data.js"]:::service
    end

    %% Connections
    Public --> Index
    Index --> App
    App --> HomeModule
    App --> HeaderModule
    App --> DetailModule
    App --> CartModule
    App --> LoginModule

    HomeModule -->|dispatch| ProductActions
    HeaderModule -->|dispatch| CartActions
    CartModule -->|dispatch| CartActions
    DetailModule -->|dispatch| ProductActions
    LoginModule -->|useContext| Context

    ProductActions --> APIClient
    CartActions --> APIClient
    APIClient -->|HTTP calls| ExternalAPI

    ExternalAPI -->|response| ProductReducer
    ExternalAPI -->|response| CartReducer

    ProductReducer --> Store
    CartReducer --> Store
    Context --> App

    Store --> HomeModule
    Store --> HeaderModule
    Store --> DetailModule
    Store --> CartModule

    %% Click Events
    click HomeModule "https://github.com/shubham08pr/flipkart-clone-frontend/tree/main/src/components/home"
    click HeaderModule "https://github.com/shubham08pr/flipkart-clone-frontend/tree/main/src/components/header"
    click DetailModule "https://github.com/shubham08pr/flipkart-clone-frontend/tree/main/src/components/detail"
    click CartModule "https://github.com/shubham08pr/flipkart-clone-frontend/tree/main/src/components/cart"
    click LoginModule "https://github.com/shubham08pr/flipkart-clone-frontend/tree/main/src/components/login"
    click App "https://github.com/shubham08pr/flipkart-clone-frontend/blob/main/src/App.js"
    click Index "https://github.com/shubham08pr/flipkart-clone-frontend/blob/main/src/index.js"
    click Store "https://github.com/shubham08pr/flipkart-clone-frontend/blob/main/src/redux/store.js"
    click ProductActions "https://github.com/shubham08pr/flipkart-clone-frontend/blob/main/src/redux/actions/productActions.js"
    click CartActions "https://github.com/shubham08pr/flipkart-clone-frontend/blob/main/src/redux/actions/cartActions.js"
    click ProductConstants "https://github.com/shubham08pr/flipkart-clone-frontend/blob/main/src/redux/constants/productConstant.js"
    click CartConstants "https://github.com/shubham08pr/flipkart-clone-frontend/blob/main/src/redux/constants/cartConstant.js"
    click ProductReducer "https://github.com/shubham08pr/flipkart-clone-frontend/blob/main/src/redux/reducers/productReducer.js"
    click CartReducer "https://github.com/shubham08pr/flipkart-clone-frontend/blob/main/src/redux/reducers/cartReducer.js"
    click Context "https://github.com/shubham08pr/flipkart-clone-frontend/blob/main/src/context/DataProvider.jsx"
    click APIClient "https://github.com/shubham08pr/flipkart-clone-frontend/blob/main/src/service/api.js"
    click Utils "https://github.com/shubham08pr/flipkart-clone-frontend/blob/main/src/utils/common-utils.js"
    click DataConst "https://github.com/shubham08pr/flipkart-clone-frontend/blob/main/src/constants/Data.js"
    click Public "https://github.com/shubham08pr/flipkart-clone-frontend/blob/main/public/index.html"

    %% Styles
    classDef frontend fill:#bbdefb,stroke:#0d47a1,color:#0d47a1
    classDef state fill:#c8e6c9,stroke:#1b5e20,color:#1b5e20
    classDef service fill:#ffe0b2,stroke:#e65100,color:#e65100
    classDef external fill:#e0e0e0,stroke:#424242,color:#424242
    classDef static fill:#f5f5f5,stroke:#9e9e9e,color:#616161
```
