# mohammedrabed/luqtaecommerce architecture

> Architecture diagram of the GitHub repository mohammedrabed/luqtaecommerce, 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/mohammedrabed/luqtaecommerce
- Repository: https://github.com/mohammedrabed/luqtaecommerce

## Overview

##### Project Type and Purpose
- This is a Kotlin-based Android mobile application (“Luqta”) implementing a second-hand, hyper-local e-commerce platform.
- It follows Clean Architecture and MVVM, uses Jetpack Compose for UI, Koin for DI, Retrofit/OkHttp for networking, DataStore + Keystore for secure storage.

##### File Structure
- Top-level module: `app/` – Android application module with Gradle build files.
- `app/src/main/java/com/example/luqtaecommerce/`:
- **data**:
– `local/` (DataStore, SessionManager, TokenManager, CryptoManager)
– `remote/` (Retrofit API `LuqtaApi`, `AuthInterceptor`, `SessionCookieJar`)
– `repository/` (interface + `LuqtaRepositoryImpl`)
- **domain**:
– `model/` (entities for auth, product, cart, order, coupon, etc.)
– `use_case/` (interactors organized by feature: auth, product, cart, order, payment, review, validation)
- **presentation**:
– `auth/`, `main/` (home, categories, products, cart, orders, profile), `splash/`
– Each screen: Composable + corresponding ViewModel + UI state classes
- **di**: Koin modules (`dataModule`, `networkModule`, `domainModule`, `viewModelModule`, `validationModule`)
- **ui**: Shared Compose components and theme definitions
- **navigation**: NavGraph, destinations, bottom-nav items
- **util**: File utilities, retry logic
- Resources: Compose-driven layouts; XML only for manifest, navigation/config, drawables, theme values
- Build & config: Gradle scripts, ProGuard rules, network security config, wrapper scripts

##### Extract Key Architectural Patterns from README
- MVVM: UI (Compose) ←→ ViewModel (StateFlow)
- Clean Architecture: Presentation ↔ Domain (use cases & models) ↔ Data (repositories & data sources)
- Dependency Injection: Koin modules wire everything
- Network: Retrofit + OkHttp + Interceptors + CookieJar
- Secure storage: Android Keystore + AES via custom `CryptoManager`

##### Main Components & Their Relationships
A. Presentation Layer
- Composable screens & shared UI components
- ViewModels (injected via Koin)
→ call domain use cases, expose UI state
B. Domain Layer
- Use cases (business logic)
- Domain models/entities
→ orchestrate repository calls
C. Data Layer
- Repository implementations (`LuqtaRepositoryImpl`)
↔ Local data source (DataStore + Keystore)
↔ Remote data source (Retrofit API)
D. External Services
- HTTP API server (auth, products, cart, orders endpoints)
E. Infrastructure
- Koin DI container
- Android Framework (OS, Jetpack ViewModel, DataStore, Security)

##### Important Patterns & Tech
- Clearly label MVVM boundary between UI & ViewModel
- Clean Architecture boundaries (presentation ↔ domain ↔ data)
- DI container feeding ViewModels, use cases, repositories
- Secure storage path: TokenManager → Android Keystore + AES
- Network pipeline: OkHttpClient → AuthInterceptor → Retrofit → API

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "UI/Presentation Layer"
        APS["Auth Screens & ViewModels"]:::presentation
        MS["Main Screens & ViewModels"]:::presentation
        SPL["Splash Screen & ViewModel"]:::presentation
        NAV["Navigation Graph & Destinations"]:::presentation
        UI["Shared UI Components & Theme"]:::presentation
    end

    subgraph "Domain Layer"
        MODELS["Domain Models/Entities"]:::domain
        USECASES["Use Cases"]:::domain
    end

    subgraph "Data Layer"
        LOCAL["Local Data Sources"]:::data
        REMOTE["Remote Data Sources"]:::data
        REPO["LuqtaRepositoryImpl"]:::data
    end

    subgraph "External API"
        API["HTTPS REST API"]:::external
    end

    subgraph "Platform/Infrastructure"
        KOIN["Koin DI Container"]:::infra
        KEYSTORE["Android Keystore"]:::infra
        DATA_INFRA["Android DataStore"]:::infra
        OKHTTP["OkHttpClient"]:::infra
    end

    APS -->|"calls"| USECASES
    MS -->|"calls"| USECASES
    SPL -->|"calls"| USECASES
    USECASES -->|"invokes"| REPO
    REPO -->|"reads/writes"| LOCAL
    REPO -->|"calls"| REMOTE
    LOCAL -->|"stores via"| DATA_INFRA
    LOCAL -->|"encrypts via"| KEYSTORE
    REMOTE -->|"uses"| OKHTTP
    OKHTTP -->|"requests/response"| API
    KOIN -->|"injects"| APS
    KOIN -->|"injects"| MS
    KOIN -->|"injects"| SPL
    KOIN -->|"injects"| USECASES
    KOIN -->|"injects"| REPO

    click APS "https://github.com/mohammedrabed/luqtaecommerce/tree/main/app/src/main/java/com/example/luqtaecommerce/presentation/auth"
    click MS "https://github.com/mohammedrabed/luqtaecommerce/tree/main/app/src/main/java/com/example/luqtaecommerce/presentation/main"
    click SPL "https://github.com/mohammedrabed/luqtaecommerce/blob/main/app/src/main/java/com/example/luqtaecommerce/presentation/splash/SplashScreen.kt"
    click NAV "https://github.com/mohammedrabed/luqtaecommerce/blob/main/app/src/main/java/com/example/luqtaecommerce/presentation/navigation/LuqtaNavGraph.kt"
    click UI "https://github.com/mohammedrabed/luqtaecommerce/tree/main/app/src/main/java/com/example/luqtaecommerce/ui/components"
    click UI "https://github.com/mohammedrabed/luqtaecommerce/tree/main/app/src/main/java/com/example/luqtaecommerce/ui/theme"
    click MODELS "https://github.com/mohammedrabed/luqtaecommerce/tree/main/app/src/main/java/com/example/luqtaecommerce/domain/model"
    click USECASES "https://github.com/mohammedrabed/luqtaecommerce/tree/main/app/src/main/java/com/example/luqtaecommerce/domain/use_case"
    click LOCAL "https://github.com/mohammedrabed/luqtaecommerce/tree/main/app/src/main/java/com/example/luqtaecommerce/data/local"
    click REMOTE "https://github.com/mohammedrabed/luqtaecommerce/tree/main/app/src/main/java/com/example/luqtaecommerce/data/remote"
    click REPO "https://github.com/mohammedrabed/luqtaecommerce/blob/main/app/src/main/java/com/example/luqtaecommerce/data/repository/LuqtaRepositoryImpl.kt"
    click KOIN "https://github.com/mohammedrabed/luqtaecommerce/tree/main/app/src/main/java/com/example/luqtaecommerce/di"

    classDef presentation fill:#cce5ff,stroke:#007bff,color:#004085
    classDef domain fill:#d4edda,stroke:#28a745,color:#155724
    classDef data fill:#fff3cd,stroke:#ffc107,color:#856404
    classDef external fill:#e2e3e5,stroke:#6c757d,color:#343a40
    classDef infra fill:#f8f9fa,stroke:#ced4da,color:#6c757d
```
