# dabbeshu/mini_ecommerce architecture

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

- Interactive diagram: https://gitdiagram.com/dabbeshu/mini_ecommerce
- Repository: https://github.com/dabbeshu/mini_ecommerce

## Overview

##### Project type and purpose
- This is a cross-platform Flutter “mini e-commerce” client application (mobile, web, desktop).
- Purpose: Allow a user to log in, fetch a product list from a remote API, view product details, and maintain session between launches.

##### File structure
- Top-level “android”, “ios”, “web”, “linux”, “windows” folders: each contains the native runner and engine integration for that platform.
- “lib/” folder holds the Dart application code, subdivided into:
- models/ – Product data classes
- controllers/ – Business logic (ProductController, login/logout)
- views/ – UI screens (login_screen, product_list_screen, product_detail_screen)
- main.dart – app entry point
- “pubspec.yaml” lists dependencies: http, provider, shared_preferences.
- No built-in backend in this repo; it consumes an external HTTP API.

##### README for additional insights
- Confirms usage of “http” for API requests, “provider” for state management, “shared_preferences” for persisting login.
- Basic run instructions, credentials, and package list.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Platform Runners
    subgraph "Platform Runners"
        android["Android Runner"]:::platform
        ios["iOS Runner"]:::platform
        web["Web Runner"]:::platform
        linux["Linux Runner"]:::platform
        windows["Windows Runner"]:::platform
    end

    %% Flutter Engine
    subgraph "Flutter Engine & Dart VM"
        engine["Flutter Engine & Dart VM"]:::engine
    end

    engine --> flutterApp

    %% Flutter App Layers
    subgraph "Flutter App"
        main["Composition Root\n(main.dart)"]:::root

        subgraph "Presentation Layer"
            login["LoginScreen"]:::ui
            list["ProductListScreen"]:::ui
            detail["ProductDetailScreen"]:::ui
        end

        subgraph "Controllers / State Management"
            productCtrl["ProductController"]:::controller
        end

        subgraph "Data Layer"
            http["HTTP Client\n(http package)"]:::data
            prefs["Local Storage\n(shared_preferences)"]:::data
        end

        subgraph "Domain Models"
            model["Product Model"]:::model
        end
    end

    %% External System
    remote["Remote E-Commerce API"]:::external

    %% User Flows
    user["User"]:::external
    user -->|taps login| login
    login -->|invokes| productCtrl
    productCtrl -->|reads/writes| prefs
    productCtrl -->|sends HTTP request| http
    http -->|fetch products| remote
    remote -->|returns JSON| model
    model -->|deserialized| productCtrl
    productCtrl -->|updates state| list
    list -->|select product| detail
    detail -->|invokes| productCtrl

    %% Composition root wiring
    main --> login
    main --> list
    main --> detail
    main --> productCtrl

    %% Click Events
    click android "https://github.com/dabbeshu/mini_ecommerce/blob/main/android/app/src/main/kotlin/com/example/mini_ecommerce/MainActivity.kt"
    click ios "https://github.com/dabbeshu/mini_ecommerce/blob/main/ios/Runner/AppDelegate.swift"
    click web "https://github.com/dabbeshu/mini_ecommerce/blob/main/web/index.html"
    click linux "https://github.com/dabbeshu/mini_ecommerce/blob/main/linux/runner/main.cc"
    click windows "https://github.com/dabbeshu/mini_ecommerce/blob/main/windows/runner/main.cpp"
    click main "https://github.com/dabbeshu/mini_ecommerce/blob/main/lib/main.dart"
    click login "https://github.com/dabbeshu/mini_ecommerce/blob/main/lib/views/login_screen.dart"
    click list "https://github.com/dabbeshu/mini_ecommerce/blob/main/lib/views/product_list_screen.dart"
    click detail "https://github.com/dabbeshu/mini_ecommerce/blob/main/lib/views/product_detail_screen.dart"
    click productCtrl "https://github.com/dabbeshu/mini_ecommerce/blob/main/lib/controllers/product_controller.dart"
    click model "https://github.com/dabbeshu/mini_ecommerce/blob/main/lib/models/product.dart"

    %% Styles
    classDef platform fill:#eeeeee,stroke:#999,stroke-width:1px
    classDef engine fill:#cfe2f3,stroke:#6fa8dc,stroke-width:2px
    classDef ui fill:#d9ead3,stroke:#6aa84f,stroke-width:1px
    classDef controller fill:#b6d7a8,stroke:#38761d,stroke-width:1px
    classDef data fill:#fff2cc,stroke:#b45f06,stroke-width:1px
    classDef model fill:#f9cb9c,stroke:#e69138,stroke-width:1px
    classDef root fill:#f4cccc,stroke:#cc0000,stroke-width:2px
    classDef external fill:#f2f2f2,stroke:#666,stroke-width:1px,stroke-dasharray: 5 5
```
