# ibrahim0011001/e-commerce-app architecture

> Architecture diagram of the GitHub repository ibrahim0011001/e-commerce-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-09-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ibrahim0011001/e-commerce-app
- Repository: https://github.com/ibrahim0011001/e-commerce-app

## Overview

##### Project type and purpose
- This is a multi-platform Flutter application (Android, iOS, Web, Desktop) named “e_commerce.”
- It serves as the frontend of an e-commerce app, implementing typical shopping flows: browsing categories, viewing products, authentication, cart management, address management, etc.

##### File structure
- Top-level platform folders (android, ios, linux, macos, windows, web) contain native embedding projects generated by Flutter.
- The core application logic lives under lib/ with two main subfolders:
- core/ – cross-cutting utilities (networking, routing, styling, common widgets).
- features/ – feature modules grouped by domain (auth, home, product, cart, account, address, main).
- State management uses the Cubit (Bloc) pattern: each feature has logic/ folder with cubit and state classes.
- Data layer in features/home/data holds repository and model definitions.
- Third-party networking leverages Dio via core/networking/dio_helper.dart and api_endpoint.dart.
- Routing centralization in core/routing/app_routing.dart with generated router config.

##### README for insights
- README is boilerplate; no specific architecture section.
- We infer standard Flutter multi-layer frontend architecture.

##### Elements
- Clear labels for each layer and component:
- “UI Screens & Widgets”
- “Cubit / Bloc State Managers”
- “Repositories & Models”
- “Network Layer (DioHelper, API Endpoints)”
- “External REST API”
- UI → Cubit → Repo → Network → API
- API → Network → Repo → Cubit → UI

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Entry Point
    subgraph "Entry Point"
        Main["main.dart"]:::core
    end

    %% Presentation Layer
    subgraph "Presentation Layer" 
        subgraph "Authentication Screens"
            Login["Login Screen"] 
            Register["Register Screen"]
        end
        subgraph "Home Screens"
            HomeScreen["Home Screen"]
            CatWidget["Category Item Widget"]
            ProdWidget["Product Item Widget"]
            TitlePrice["Title & Price Widget"]
        end
        subgraph "Cart Screens"
            CartScreen["Cart Screen"]
            CartItem["Cart Item Widget"]
        end
        subgraph "Account Screens"
            AccountScreen["Account Screen"]
            AccountItem["Account Item Widget"]
        end
        subgraph "Address Screens"
            AddressScreen["Address Screen"]
            AddressItem["Address Item Widget"]
        end
        ProductScreen["Product Screen"]
        MainScreen["Main Screen"]
    end

    %% Business Logic Layer
    subgraph "Business Logic Layer"
        subgraph "Home Logic"
            CatCubit["Category Cubit"]
            ProdCubit["Products Cubit"]
        end
        subgraph "Cart Logic"
            CartCubit["Cart Cubit"]
        end
    end

    %% Data Layer
    subgraph "Data Layer"
        subgraph "Home Data"
            CatRepo["Category Repository"]
            ProdRepo["Product Repository"]
            CatModel["Category Model"]
            ProdModel["Product Model"]
        end
    end

    %% Infrastructure Layer
    subgraph "Infrastructure Layer"
        DioHelper["Dio Helper"]
        APIEndpoint["API Endpoint"]
    end

    %% Routing
    subgraph "Routing"
        AppRouter["App Routing"]
        RouterConfig["Router Generation Config"]
    end

    %% Core Utilities
    subgraph "Core Utilities"
        Assets["App Assets"]
        Colors["App Colors"]
        Fonts["App Fonts"]
        Styles["App Styles"]
        TextField["Custom Text Field"]
        Button["Primary Button"]
        Spacing["Spacing Widget"]
    end

    %% External Services
    ExternalAPI["External REST API"]:::external
    Payment["Payment Gateway"]:::external

    %% Connections
    Main -->|"initializes"| AppRouter
    AppRouter -->|"navigates to"| Login
    AppRouter -->|"navigates to"| HomeScreen
    AppRouter -->|"navigates to"| CartScreen
    AppRouter -->|"navigates to"| AccountScreen
    AppRouter -->|"navigates to"| AddressScreen
    AppRouter -->|"navigates to"| ProductScreen
    AppRouter -->|"navigates to"| MainScreen

    Login -->|"dispatches events to"| CatCubit
    Register -->|"dispatches events to"| CartCubit
    HomeScreen -->|"dispatches events to"| CatCubit
    HomeScreen -->|"dispatches events to"| ProdCubit
    CartScreen -->|"dispatches events to"| CartCubit

    CatCubit -->|"calls"| CatRepo
    ProdCubit -->|"calls"| ProdRepo
    CartCubit -->|"calls"| ProdRepo

    CatRepo -->|"uses model"| CatModel
    ProdRepo -->|"uses model"| ProdModel

    CatRepo -->|"invokes"| DioHelper
    ProdRepo -->|"invokes"| DioHelper

    DioHelper -->|"reads endpoints from"| APIEndpoint
    DioHelper -->|"HTTP calls to"| ExternalAPI
    ExternalAPI -->|"responses to"| DioHelper

    AppRouter --> RouterConfig
    HomeScreen --> CatWidget
    HomeScreen --> ProdWidget
    HomeScreen --> TitlePrice
    CartScreen --> CartItem
    AccountScreen --> AccountItem
    AddressScreen --> AddressItem

    Main --> Assets
    Main --> Colors
    Main --> Fonts
    Main --> Styles
    Main --> TextField
    Main --> Button
    Main --> Spacing

    ExternalAPI -->|"integrates with"| Payment

    %% Click Events
    click Main "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/main.dart"
    click Login "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/features/auth/login_screen.dart"
    click Register "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/features/auth/register_screen.dart"
    click HomeScreen "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/features/home/home_screen.dart"
    click CatWidget "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/features/home/widgets/category_item_widget.dart"
    click ProdWidget "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/features/home/widgets/product_item_widget.dart"
    click TitlePrice "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/features/home/widgets/title_price_widget.dart"
    click CartScreen "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/features/Cart/cart_screen.dart"
    click CartItem "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/features/Cart/widgets/cart_item_widget.dart"
    click AccountScreen "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/features/account/account_screen.dart"
    click AccountItem "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/features/account/widgets/account_item_widget.dart"
    click AddressScreen "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/features/address/address_screen.dart"
    click AddressItem "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/features/address/widgets/address_item_widget.dart"
    click ProductScreen "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/features/product/product_screen.dart"
    click MainScreen "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/features/main/main_screen.dart"
    click CatCubit "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/features/home/logic/category_cubit.dart"
    click CatRepo "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/features/home/data/catgory_repo.dart"
    click ProdCubit "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/features/home/logic/products_cubit.dart"
    click CartCubit "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/features/Cart/logic/cart_cubit.dart"
    click CatModel "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/features/home/data/models/catagorymodel.dart"
    click ProdModel "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/features/home/data/models/productmodel.dart"
    click DioHelper "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/core/networking/dio_helper.dart"
    click APIEndpoint "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/core/networking/api_endpoint.dart"
    click AppRouter "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/core/routing/app_routing.dart"
    click RouterConfig "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/core/routing/router_generation_config.dart"
    click Assets "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/core/assets/app_assets.dart"
    click Colors "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/core/styles/app_color.dart"
    click Fonts "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/core/styles/app_fonts.dart"
    click Styles "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/core/styles/app_styles.dart"
    click TextField "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/core/widgets/custom_text_field.dart"
    click Button "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/core/widgets/primay_button_widget.dart"
    click Spacing "https://github.com/ibrahim0011001/e-commerce-app/blob/main/lib/core/widgets/spaceing_widget.dart"

    %% Styles
    classDef presentation fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef business fill:#90EE90,stroke:#333,stroke-width:1px
    classDef data fill:#B2DFDB,stroke:#333,stroke-width:1px
    classDef infra fill:#FFCC80,stroke:#333,stroke-width:1px
    classDef core fill:#C5E1A5,stroke:#333,stroke-width:1px
    classDef external fill:#CFD8DC,stroke:#333,stroke-width:1px

    class Main,Assets,Colors,Fonts,Styles,TextField,Button,Spacing core
    class Login,Register,HomeScreen,CatWidget,ProdWidget,TitlePrice,CartScreen,CartItem,AccountScreen,AccountItem,AddressScreen,AddressItem,ProductScreen,MainScreen presentation
    class CatCubit,ProdCubit,CartCubit business
    class CatRepo,ProdRepo,CatModel,ProdModel data
    class DioHelper,APIEndpoint infra
    class ExternalAPI,Payment external
```
