# adityav025/munche architecture

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

- Interactive diagram: https://gitdiagram.com/adityav025/munche
- Repository: https://github.com/adityav025/munche

## Overview

##### Key Architectural Layers and Components
- Presentation Layer: This consists of the Android UI components such as Activities, Fragments, and Adapters. For instance, you have multiple UI packages (ui/auth, ui/cart, ui/order, ui/location, ui/main, ui/review) as well as fragments (e.g., FavouriteFragment, RestaurantFragment, SearchFragment) and adapters (SearchListAdapter.kt).
- Domain/Business Logic Layer: This includes the core functionalities (e.g., user authentication, order processing, and review submissions). Although business logic may be interwoven in activities and helper classes, identify classes that coordinate functionalities.
- Data Model Layer: Encompasses the model classes (found under the models package) like RestaurantDetail, CartItemDetail, ReviewDetails, etc. These represent the data structures used in the app.
- External Integrations/Services:
- Firebase Suite – used for authentication, database, and storage.
- Mapbox – provides mapping and route generation functionalities.
- Paytm SDK – for handling the payment integration (with a note about a separate checksum server component).
- Other libraries like Glide (for image loading), Lottie (for animations), and Smiley Rating Bar.

##### Interactions and Data Flow
- User actions on the UI (Activities/Fragments) trigger business logic flows that consult model data objects.
- Communication with external services like Firebase for authentication and database management happens directly from specific business logic components or through dedicated service classes.
- Mapbox integration is used for verifying user location and route generation.
- Payment processing includes a special flow where a checksum must be generated using a backend server. Indicate this network call from the CheckoutActivity.
- Adapters and view helpers ensure data is passed and displayed correctly (e.g., SearchListAdapter for search results).

##### Architectural Patterns and Design Principles
- The UI (presentation layer) is separated from the data models.
- Use of asynchronous tasks when communicating with servers (for checksum generation) and note that there is a helper for this functionality in the order package.

## Diagram (Mermaid)

```mermaid
flowchart TD

    subgraph "Presentation Layer"
        UI1["ui/auth (Auth Activities)"]
        UI2["ui/cart (Cart Activities)"]
        UI3["ui/order (Order Processing)"]
        UI4["ui/location (Location Handling)"]
        UI5["ui/main (Main Restaurant Activity)"]
        UI6["ui/review (Review Activities)"]
        UI7["fragments (UI Fragments)"]
        UI8["adapters (Adapters)"]
    end

    Data["Data Models"]
    Utils["Utilities"]

    Firebase["Firebase"]
    Mapbox["Mapbox"]
    Paytm["Paytm"]
    Checksum["Checksum Server"]

    %% Interactions Between Presentation Layer and External Services
    UI1 -->|"auth"| Firebase
    UI5 -->|"dataCall"| Firebase
    UI4 -->|"mapCall"| Mapbox
    UI3 -->|"payment"| Paytm
    UI3 -->|"checksum"| Checksum

    %% Interactions Within the Mobile Application
    UI7 -->|"binds"| Data
    UI7 -->|"helpers"| Utils
    UI1 -->|"uses"| Data
    UI2 -->|"updates"| Data
    UI3 -->|"retrieves"| Data
    UI6 -->|"submits"| Data

    %% Class Definitions for Colour Coding
    classDef ui fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef data fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef util fill:#D5F5E3,stroke:#27AE60,stroke-width:2px;
    classDef external fill:#FADBD8,stroke:#C0392B,stroke-width:2px;

    class UI1,UI2,UI3,UI4,UI5,UI6,UI7,UI8 ui;
    class Data data;
    class Utils util;
    class Firebase,Mapbox,Paytm,Checksum external;

    %% Click Events Mapping
    click UI1 "https://github.com/adityav025/munche/tree/master/app/src/main/java/ui/auth"
    click UI2 "https://github.com/adityav025/munche/tree/master/app/src/main/java/ui/cart"
    click UI3 "https://github.com/adityav025/munche/tree/master/app/src/main/java/ui/order"
    click UI4 "https://github.com/adityav025/munche/tree/master/app/src/main/java/ui/location"
    click UI5 "https://github.com/adityav025/munche/tree/master/app/src/main/java/ui/main"
    click UI6 "https://github.com/adityav025/munche/tree/master/app/src/main/java/ui/review"
    click UI7 "https://github.com/adityav025/munche/tree/master/app/src/main/java/fragments"
    click UI8 "https://github.com/adityav025/munche/tree/master/app/src/main/java/adapters"
    click Data "https://github.com/adityav025/munche/tree/master/app/src/main/java/models"
    click Utils "https://github.com/adityav025/munche/tree/master/app/src/main/java/utils"
```
