# mustafa-muhamed-mansour/hatla2e-kotlin architecture

> Architecture diagram of the GitHub repository mustafa-muhamed-mansour/hatla2e-kotlin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mustafa-muhamed-mansour/hatla2e-kotlin
- Repository: https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin

## Overview

LAFA is an Android product-browsing app with search and saved favorites. Users enter the app, browse banners, categories, and products, open product details, search the catalog, and save products for later; account, profile, settings, FAQ, and complaint screens provide additional capabilities. The sampled code supports the UI-to-view-model and repository-to-API portions of these flows, plus local favorite storage. ViewModel-to-repository wiring and several unsampled feature implementations are shown as unverified or omitted rather than inferred.

Main entry points: [`app/src/main/java/com/lafa/home/HomeFragment.kt`](https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/home/HomeFragment.kt) (Home catalog), [`app/src/main/java/com/lafa/home/HomeViewModel.kt`](https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/home/HomeViewModel.kt) (Catalog state), [`app/src/main/java/com/lafa/network/remote/ApiService.kt`](https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/network/remote/ApiService.kt) (REST API), [`app/src/main/java/com/lafa/repositories/HomeRepository.kt`](https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/repositories/HomeRepository.kt) (Catalog repository)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_browse["Catalog browsing"]
  node_home["Home catalog<br/>[HomeFragment.kt]"]
  node_homevm["Catalog state<br/>[HomeViewModel.kt]"]
  node_product["Product details"]
  node_search["Product search<br/>[SearchFragment.kt]"]
  node_searchvm["Search state<br/>[SearchViewModel.kt]"]
  node_favorites["Saved products"]
  node_favoritevm["Favorite state"]
end

subgraph group_account["Accounts and support"]
  node_login["Sign-in<br/>[LoginFragment.kt]"]
  node_register["Registration"]
  node_profile["Profile management<br/>[ProfileFragment.kt]"]
  node_settings["Settings and contacts<br/>[SettingFragment.kt]"]
  node_questions["FAQs"]
  node_complaints["Complaints"]
end

subgraph group_data["Data and persistence"]
  node_searchrepo["Search repository"]
  node_api["REST API<br/>[ApiService.kt]"]
  node_home_repo["Catalog repository<br/>[HomeRepository.kt]"]
  node_db[("Product database<br/>[ProductDatabase.kt]")]
  node_dao["Favorite product access<br/>[ProductDao.kt]"]
end

subgraph group_runtime["App runtime"]
  node_main["Main navigation<br/>[MainActivity.kt]"]
  node_service["Connectivity receiver"]
end

node_shopper(("Shopper"))

node_shopper -.->|"opens app"| node_main
node_shopper -.->|"browses catalog"| node_home
node_home -->|"requests catalog"| node_homevm
node_homevm -.->|"loads catalog"| node_home_repo
node_home_repo -->|"fetches catalog"| node_api
node_home_repo -->|"stores favorites"| node_db
node_db -->|"provides access"| node_dao
node_home -->|"opens details"| node_product
node_shopper -->|"searches products"| node_search
node_search -->|"submits query"| node_searchvm
node_searchvm -.->|"requests results"| node_searchrepo
node_searchrepo -->|"posts search"| node_api
node_shopper -->|"reviews saved"| node_favorites
node_home -->|"saves product"| node_homevm
node_homevm -.->|"persists favorite"| node_db
node_shopper -.->|"signs in"| node_login
node_shopper -.->|"creates account"| node_register
node_shopper -.->|"manages profile"| node_profile
node_shopper -.->|"opens settings"| node_settings
node_settings -->|"navigates to FAQs"| node_questions
node_shopper -.->|"submits complaint"| node_complaints
node_api -.->|"serves endpoints"| node_api
node_home -->|"registers receiver"| node_service

click node_main "https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/ui/MainActivity.kt"
click node_home "https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/home/HomeFragment.kt"
click node_homevm "https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/home/HomeViewModel.kt"
click node_product "https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/product_detail/ProductDetailFragment.kt"
click node_search "https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/search/SearchFragment.kt"
click node_searchvm "https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/search/SearchViewModel.kt"
click node_searchrepo "https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/repositories/SearchRepository.kt"
click node_favorites "https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/favorite/FavoriteFragment.kt"
click node_favoritevm "https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/favorite/FavoriteViewModel.kt"
click node_login "https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/login/LoginFragment.kt"
click node_register "https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/register/RegisterFragment.kt"
click node_profile "https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/profile/ProfileFragment.kt"
click node_settings "https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/setting/SettingFragment.kt"
click node_questions "https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/question/QuestionFragment.kt"
click node_complaints "https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/complaint/ComplaintFragment.kt"
click node_api "https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/network/remote/ApiService.kt"
click node_home_repo "https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/repositories/HomeRepository.kt"
click node_db "https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/network/local/ProductDatabase.kt"
click node_dao "https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/network/local/ProductDao.kt"
click node_service "https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/check_internet/CheckInternetService.kt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_home,node_homevm,node_product,node_search,node_searchvm,node_favorites,node_favoritevm toneBlue
class node_login,node_register,node_profile,node_settings,node_questions,node_complaints toneAmber
class node_searchrepo,node_api,node_home_repo,node_db,node_dao toneMint
class node_main,node_service toneRose
class node_shopper toneIndigo
```

## Components

### Catalog browsing

- [Home catalog](https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/home/HomeFragment.kt): `app/src/main/java/com/lafa/home/HomeFragment.kt`
- [Catalog state](https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/home/HomeViewModel.kt): `app/src/main/java/com/lafa/home/HomeViewModel.kt`
- [Product details](https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/product_detail/ProductDetailFragment.kt): `app/src/main/java/com/lafa/product_detail/ProductDetailFragment.kt`
- [Product search](https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/search/SearchFragment.kt): `app/src/main/java/com/lafa/search/SearchFragment.kt`
- [Search state](https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/search/SearchViewModel.kt): `app/src/main/java/com/lafa/search/SearchViewModel.kt`
- [Saved products](https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/favorite/FavoriteFragment.kt): `app/src/main/java/com/lafa/favorite/FavoriteFragment.kt`
- [Favorite state](https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/favorite/FavoriteViewModel.kt): `app/src/main/java/com/lafa/favorite/FavoriteViewModel.kt`

### Accounts and support

- [Sign-in](https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/login/LoginFragment.kt): `app/src/main/java/com/lafa/login/LoginFragment.kt`
- [Registration](https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/register/RegisterFragment.kt): `app/src/main/java/com/lafa/register/RegisterFragment.kt`
- [Profile management](https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/profile/ProfileFragment.kt): `app/src/main/java/com/lafa/profile/ProfileFragment.kt`
- [Settings and contacts](https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/setting/SettingFragment.kt): `app/src/main/java/com/lafa/setting/SettingFragment.kt`
- [FAQs](https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/question/QuestionFragment.kt): `app/src/main/java/com/lafa/question/QuestionFragment.kt`
- [Complaints](https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/complaint/ComplaintFragment.kt): `app/src/main/java/com/lafa/complaint/ComplaintFragment.kt`

### Data and persistence

- [Search repository](https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/repositories/SearchRepository.kt): `app/src/main/java/com/lafa/repositories/SearchRepository.kt`
- [REST API](https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/network/remote/ApiService.kt): `app/src/main/java/com/lafa/network/remote/ApiService.kt`
- [Catalog repository](https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/repositories/HomeRepository.kt): `app/src/main/java/com/lafa/repositories/HomeRepository.kt`
- [Product database](https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/network/local/ProductDatabase.kt): `app/src/main/java/com/lafa/network/local/ProductDatabase.kt`
- [Favorite product access](https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/network/local/ProductDao.kt): `app/src/main/java/com/lafa/network/local/ProductDao.kt`

### App runtime

- [Main navigation](https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/ui/MainActivity.kt): `app/src/main/java/com/lafa/ui/MainActivity.kt`
- [Connectivity receiver](https://github.com/mustafa-muhamed-mansour/hatla2e-kotlin/blob/master/app/src/main/java/com/lafa/check_internet/CheckInternetService.kt): `app/src/main/java/com/lafa/check_internet/CheckInternetService.kt`

### Other components

- **Shopper**

## Connections

- Shopper → Main navigation: opens app
- Shopper → Home catalog: browses catalog (evidence: `README.md`)
- Home catalog → Catalog state: requests catalog (evidence: `app/src/main/java/com/lafa/home/HomeFragment.kt`)
- Catalog state → Catalog repository: loads catalog (evidence: `app/src/main/java/com/lafa/home/HomeViewModel.kt`)
- Catalog repository → REST API: fetches catalog (evidence: `app/src/main/java/com/lafa/repositories/HomeRepository.kt`)
- Catalog repository → Product database: stores favorites (evidence: `app/src/main/java/com/lafa/repositories/HomeRepository.kt`)
- Product database → Favorite product access: provides access (evidence: `app/src/main/java/com/lafa/network/local/ProductDatabase.kt`)
- Home catalog → Product details: opens details (evidence: `app/src/main/java/com/lafa/home/HomeFragment.kt`)
- Shopper → Product search: searches products (evidence: `README.md`)
- Product search → Search state: submits query (evidence: `app/src/main/java/com/lafa/search/SearchFragment.kt`)
- Search state → Search repository: requests results
- Search repository → REST API: posts search (evidence: `app/src/main/java/com/lafa/repositories/SearchRepository.kt`)
- Shopper → Saved products: reviews saved (evidence: `README.md`)
- Home catalog → Catalog state: saves product (evidence: `app/src/main/java/com/lafa/home/HomeFragment.kt`)
- Catalog state → Product database: persists favorite
- Shopper → Sign-in: signs in
- Shopper → Registration: creates account
- Shopper → Profile management: manages profile
- Shopper → Settings and contacts: opens settings
- Settings and contacts → FAQs: navigates to FAQs (evidence: `app/src/main/java/com/lafa/setting/SettingFragment.kt`)
- Shopper → Complaints: submits complaint
- REST API → REST API: serves endpoints (evidence: `app/src/main/java/com/lafa/network/remote/ApiService.kt`)
- Home catalog → Connectivity receiver: registers receiver (evidence: `app/src/main/java/com/lafa/home/HomeFragment.kt`)
