# ananduvijay/ecomstore architecture

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

- Interactive diagram: https://gitdiagram.com/ananduvijay/ecomstore
- Repository: https://github.com/ananduvijay/ecomstore

## Overview

##### Project type and purpose
- This is a React Native mobile application for an e-commerce store (“EcomStore”) that runs on both Android and iOS.
- The JavaScript code (under src/) implements product listing, shopping cart screens, navigation, and global state (via React Context).
- Native folders (android/ and ios/) contain platform-specific bootstrap code, resources, and build configurations.

##### File structure
- Top-level:
- android/ & ios/ → Native projects, Gradle & Xcode setups, platform resources.
- src/ → All JS/TSX application code:
– assets/ (images & constants)
– context/ (CartContext.js for global state)
– navigation/ (AppNavigation.js for React Navigation setup)
– screen/ (screen-level folders: productListing, cart; each with components & styles)
- index.js & App.js → JS entrypoints
- metro.config.js, babel.config.js → bundler & transpiler configs
- package.json, yarn.lock → dependencies & scripts

##### Extract architecture hints from the README
- Bootstrapped with @react-native-community/cli
- Metro bundler serves JS to native shell
- Typical RN dev workflow described (npm/yarn start, run on emulator)

##### Main components
A. React Native JS Layer
- UI Screens (ProductListingScreen, CartScreen)
- Components (ProductCard, CartItems, CheckoutBar, AddressBox, etc.)
- Navigation module (React Navigation)
- State management (CartContext)
- Assets & styling modules
B. Bundler & Tooling
- Metro Bundler (serves JS bundle)
- Babel (transpiles modern JS/TS)
- Yarn / npm (package manager)
C. Native Shells
- Android native project (Gradle, MainActivity.kt, MainApplication.kt)
- iOS native project (Xcode project, AppDelegate, Info.plist)
- React Native Bridge (JS ↔ native module communication)
- REST / GraphQL APIs (product catalog, cart management, auth, payments)
- Third-party SDKs (e.g. analytics, crash reporting)

##### Relationships and interactions
- Metro Bundler → serves a JS bundle → loaded into Native Shell at runtime
- JS Layer (UI & business logic) → via React Native Bridge → invokes native modules (camera, storage)
- JS Layer → HTTP calls → External API servers → returns JSON data → UI updates via Context
- Navigation component routes between screens, passing props/state
- CartContext holds global state, consumed by screen components

##### Architectural patterns & design principles
- Single Page App pattern inside a mobile container
- Modular screen/component decomposition (each screen folder encapsulates its UI and logic)
- Unidirectional data flow via Context API
- Clear separation: UI components ↔ business logic ↔ data layer (API)
- Native / JS boundary over React Native Bridge

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% React Native JS Layer
    subgraph "React Native JS Layer"
        index["index.js"]:::ui
        App["App.js"]:::ui
        subgraph "Screens & Components"
            subgraph "Product Listing Screen"
                PLS["ProductListingScreen"]:::ui
                PC["ProductCard"]:::ui
                Cat["Category"]:::ui
                COB["CheckOutBar"]:::ui
                PM["PromoCode"]:::ui
                Str["Store"]:::ui
                H1["Header"]:::ui
            end
            subgraph "Cart Screen"
                CS["CartScreen"]:::ui
                AB["AddressBox"]:::ui
                CI["CartItems"]:::ui
                DD["DeliveryDay"]:::ui
                DT["DeliveryTime"]:::ui
                DType["DeliveryType"]:::ui
                H2["Header"]:::ui
                PrC["PriceCard"]:::ui
                ProC["ProceedCard"]:::ui
                PL["ProductList"]:::ui
            end
        end
    end

    %% State & Navigation
    subgraph "State & Navigation"
        Nav["AppNavigation"]:::state
        CartCtx["CartContext"]:::state
    end

    %% Bundler & Tooling
    subgraph "Bundler & Tooling"
        Metro["Metro Bundler"]:::tooling
        Babel["Babel"]:::tooling
        PMgr["Package Manager"]:::tooling
    end

    %% Native Shells
    subgraph "Native Shells"
        subgraph Android
            MA["MainActivity.kt"]:::native
            MApp["MainApplication.kt"]:::native
            ABld["build.gradle"]:::native
        end
        subgraph iOS
            ADh["AppDelegate.h"]:::native
            ADm["AppDelegate.mm"]:::native
            Info["Info.plist"]:::native
            Xcode["EcomStore.xcodeproj"]:::native
        end
    end

    %% External Services
    subgraph "External Services"
        API["REST/GraphQL APIs"]:::external
        SDK["Third-party SDKs"]:::external
    end

    %% Connections
    index --> App
    App --> Nav
    Nav --> PLS
    Nav --> CS
    Nav --> CartCtx
    CartCtx --> PLS
    CartCtx --> CS

    PLS --> PC
    PLS --> Cat
    PLS --> COB
    PLS --> PM
    PLS --> Str
    PLS --> H1

    CS --> AB
    CS --> CI
    CS --> DD
    CS --> DT
    CS --> DType
    CS --> H2
    CS --> PrC
    CS --> ProC
    CS --> PL

    App --> Metro
    Metro --> Babel
    Metro --> PMgr

    App --> MA
    App --> ADm

    PLS -->|"HTTP requests"| API
    CS -->|"HTTP requests"| API
    API -->|"JSON response"| CartCtx

    PLS -->|"UI Event"| CartCtx
    CartCtx -->|"State Update"| PLS
    CartCtx -->|"State Update"| CS

    SDK --> App

    %% Click Events
    click index "https://github.com/ananduvijay/ecomstore/blob/main/index.js"
    click App "https://github.com/ananduvijay/ecomstore/blob/main/App.js"
    click PLS "https://github.com/ananduvijay/ecomstore/blob/main/src/screen/productListing/ProductListing.js"
    click PC "https://github.com/ananduvijay/ecomstore/blob/main/src/screen/productListing/components/productCard/ProductCard.js"
    click Cat "https://github.com/ananduvijay/ecomstore/blob/main/src/screen/productListing/components/category/Category.js"
    click COB "https://github.com/ananduvijay/ecomstore/blob/main/src/screen/productListing/components/checkoutBar/CheckOutBar.js"
    click PM "https://github.com/ananduvijay/ecomstore/blob/main/src/screen/productListing/components/promocode/PromoCode.js"
    click Str "https://github.com/ananduvijay/ecomstore/blob/main/src/screen/productListing/components/store/Store.js"
    click H1 "https://github.com/ananduvijay/ecomstore/blob/main/src/screen/productListing/components/header/Header.js"
    click CS "https://github.com/ananduvijay/ecomstore/blob/main/src/screen/cart/CartScreen.js"
    click AB "https://github.com/ananduvijay/ecomstore/blob/main/src/screen/cart/components/addressBox/AddressBox.js"
    click CI "https://github.com/ananduvijay/ecomstore/blob/main/src/screen/cart/components/cartItems/CartItems.js"
    click DD "https://github.com/ananduvijay/ecomstore/blob/main/src/screen/cart/components/deliveryDay/DeliveryDay.js"
    click DT "https://github.com/ananduvijay/ecomstore/blob/main/src/screen/cart/components/deliveryTime/DeliveryTime.js"
    click DType "https://github.com/ananduvijay/ecomstore/blob/main/src/screen/cart/components/deliveyType/DeliveryType.js"
    click H2 "https://github.com/ananduvijay/ecomstore/blob/main/src/screen/cart/components/header/Header.js"
    click PrC "https://github.com/ananduvijay/ecomstore/blob/main/src/screen/cart/components/priceCard/PriceCard.js"
    click ProC "https://github.com/ananduvijay/ecomstore/blob/main/src/screen/cart/components/proceedCard/ProceedCard.js"
    click PL "https://github.com/ananduvijay/ecomstore/blob/main/src/screen/cart/components/productList/ProductList.js"
    click Nav "https://github.com/ananduvijay/ecomstore/blob/main/src/navigation/AppNavigation.js"
    click CartCtx "https://github.com/ananduvijay/ecomstore/blob/main/src/context/CartContext.js"
    click Metro "https://github.com/ananduvijay/ecomstore/blob/main/metro.config.js"
    click Babel "https://github.com/ananduvijay/ecomstore/blob/main/babel.config.js"
    click PMgr "https://github.com/ananduvijay/ecomstore/blob/main/package.json"
    click MA "https://github.com/ananduvijay/ecomstore/blob/main/android/app/src/main/java/com/ecomstore/MainActivity.kt"
    click MApp "https://github.com/ananduvijay/ecomstore/blob/main/android/app/src/main/java/com/ecomstore/MainApplication.kt"
    click ABld "https://github.com/ananduvijay/ecomstore/blob/main/android/app/build.gradle"
    click ADh "https://github.com/ananduvijay/ecomstore/blob/main/ios/EcomStore/AppDelegate.h"
    click ADm "https://github.com/ananduvijay/ecomstore/blob/main/ios/EcomStore/AppDelegate.mm"
    click Info "https://github.com/ananduvijay/ecomstore/blob/main/ios/EcomStore/Info.plist"
    click Xcode "https://github.com/ananduvijay/ecomstore/blob/main/ios/EcomStore.xcodeproj"

    %% Styles
    classDef ui fill:#e0ffe0,stroke:#2d8f2d,color:#000;
    classDef state fill:#e0f0ff,stroke:#1a5dab,color:#000;
    classDef tooling fill:#fff0e0,stroke:#e07b00,color:#000;
    classDef native fill:#f0f0f0,stroke:#888888,color:#000;
    classDef external fill:#ffe0e0,stroke:#d12d2d,color:#000;
```
