# idriss-rayan/e_commerceapp architecture

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

- Interactive diagram: https://gitdiagram.com/idriss-rayan/e_commerceapp
- Repository: https://github.com/idriss-rayan/e_commerceapp

## Overview

##### Project type and purpose
- This is a cross-platform Flutter application scaffolded via `flutter create`.
- It targets Android (under `android/`), Web (under `web/`) and uses Dart code in `lib/` for UI, navigation, API calls and local user data.
- Its core features, inferred from the file tree, are user authentication (login/signup), a tab-based dashboard (home, orders, favorites, profile), remote API integration, and local persistence of the current user.

##### File structure
- Top-level platform folders:
- `android/`  – native Android project, manifest, Gradle scripts
- Core Dart code under `lib/`:
- `main.dart` – app entry point, MaterialApp setup, route logic
- `api_connection/` – HTTP client or service layer
- `users/authentication/` – login/signup UI screens
- `users/fragments/` – bottom-nav fragments (home, orders, favorites, profile)
- `users/model/` – `User` data class
- `users/userPreferences/` – local storage of current user (shared_preferences)
- Test folder for widget tests under `test/`.

##### README for additional insights
- The README is the default Flutter starter description. No custom architecture notes.

##### Detail without overthinking
- How `main.dart` orchestrates startup → auth check → dashboard.
- Your widget navigation flow alongside data/service calls.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Backend
    ExternalAPI["External Backend API"]:::external

    %% Service Layer
    subgraph "Service Layer"
        direction TB
        ApiConnection["ApiConnection"]:::service
    end

    %% Flutter Presentation
    subgraph "Flutter Presentation"
        direction TB
        MainApp["MainApp (lib/main.dart)"]:::frontend
        subgraph "Auth UI"
            direction TB
            LoginScreen["LoginScreen"]:::frontend
            SignupScreen["SignupScreen"]:::frontend
        end
        subgraph "Dashboard UI"
            direction TB
            DashboardContainer["DashboardOfFragments"]:::frontend
            HomeFragment["HomeFragmentScreen"]:::frontend
            OrdersFragment["OrderFragmentScreen"]:::frontend
            FavoritesFragment["FavoritesFragmentScreen"]:::frontend
            ProfileFragment["ProfileFragmentScreen"]:::frontend
        end
    end

    %% Data Layer
    subgraph "Data Layer"
        direction TB
        UserPreferences["UserPreferences"]:::data
        CurrentUser["CurrentUser"]:::data
        UserModel["User Model"]:::data
    end

    %% Platform Hosts
    subgraph "Platform Hosts"
        direction TB
        AndroidHost["Android Host"]:::platform
        WebHost["Web Host"]:::platform
    end

    %% Relationships
    MainApp -->|initializes & routes| LoginScreen
    MainApp -->|initializes & routes| SignupScreen
    MainApp -->|initializes & routes| DashboardContainer

    LoginScreen -->|calls| ApiConnection
    SignupScreen -->|calls| ApiConnection
    DashboardContainer -->|calls| ApiConnection

    ApiConnection -->|HTTP requests| ExternalAPI
    ExternalAPI -->|HTTP responses| ApiConnection
    ApiConnection -->|returns data| LoginScreen
    ApiConnection -->|returns data| SignupScreen
    ApiConnection -->|returns data| DashboardContainer

    LoginScreen -->|save auth| UserPreferences
    SignupScreen -->|save auth| UserPreferences
    MainApp -->|load user| CurrentUser
    CurrentUser -->|provides user| MainApp

    MainApp -->|navigates| HomeFragment
    DashboardContainer -->|contains| HomeFragment
    DashboardContainer -->|contains| OrdersFragment
    DashboardContainer -->|contains| FavoritesFragment
    DashboardContainer -->|contains| ProfileFragment

    MainApp <-->|runs on| AndroidHost
    MainApp <-->|runs on| WebHost

    %% Click Events
    click MainApp "https://github.com/idriss-rayan/e_commerceapp/blob/main/lib/main.dart"
    click LoginScreen "https://github.com/idriss-rayan/e_commerceapp/blob/main/lib/users/authentication/login_screen.dart"
    click SignupScreen "https://github.com/idriss-rayan/e_commerceapp/blob/main/lib/users/authentication/signup_screen.dart"
    click DashboardContainer "https://github.com/idriss-rayan/e_commerceapp/blob/main/lib/users/fragments/dashboard_of_fragments.dart"
    click HomeFragment "https://github.com/idriss-rayan/e_commerceapp/blob/main/lib/users/fragments/home_fragment_screen.dart"
    click OrdersFragment "https://github.com/idriss-rayan/e_commerceapp/blob/main/lib/users/fragments/order_fragment_screen.dart"
    click FavoritesFragment "https://github.com/idriss-rayan/e_commerceapp/blob/main/lib/users/fragments/favorites_fragment_screen.dart"
    click ProfileFragment "https://github.com/idriss-rayan/e_commerceapp/blob/main/lib/users/fragments/profile_fragment_screen.dart"
    click ApiConnection "https://github.com/idriss-rayan/e_commerceapp/blob/main/lib/api_connection/api_connection.dart"
    click UserPreferences "https://github.com/idriss-rayan/e_commerceapp/blob/main/lib/users/userPreferences/user_preferences.dart"
    click CurrentUser "https://github.com/idriss-rayan/e_commerceapp/blob/main/lib/users/userPreferences/current_user.dart"
    click UserModel "https://github.com/idriss-rayan/e_commerceapp/blob/main/lib/users/model/user.dart"
    click AndroidHost "https://github.com/idriss-rayan/e_commerceapp/tree/main/android/"
    click WebHost "https://github.com/idriss-rayan/e_commerceapp/tree/main/web/"

    %% Styles
    classDef frontend fill:#D0E8FF,stroke:#0366D6,stroke-width:1px;
    classDef service fill:#DFFFD0,stroke:#228B22,stroke-width:1px;
    classDef data fill:#FFEFD0,stroke:#FF8C00,stroke-width:1px;
    classDef platform fill:#F0F0F0,stroke:#888888,stroke-width:1px,stroke-dasharray: 5 5;
    classDef external fill:#E8E8E8,stroke:#666666,stroke-width:1px,stroke-dasharray: 2 2;
```
