# simcoderyoutube/uberclone architecture

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

## Overview

##### Main Components
- Android Client App:
- The core of the project is the Android app. Its directory structure (under “android”) clearly separates different modules such as Customer, Driver, Login, Payment, History, and UI Adapters.
- Use sub-components to represent distinct screens/activities (e.g., CustomerMapActivity, DriverMapActivity, AuthenticationActivity) and their related fragments (LoginFragment, RegisterFragment, MenuFragment).
- Firebase Functions:
- The “Firebase_Functions” folder indicates server-side logic (potentially for notifications or other business logic), including its configuration (firebase.json) and code (index.js and index.html).
- Firebase Services (Backend Services):
- The app uses Firebase Authentication for managing users.
- The app integrates with Firebase Realtime Database (supported by the realtime_database_rules.json file) for storing dynamic data like rides, user profiles, and history.
- Firebase Storage is also mentioned to be used, which could be for storing profile pictures or document uploads.

##### Relationships and Data Flow
- The Android Client App interacts with Firebase Services to perform:
- User Authentication (login/register flows).
- Real-time data operations (ride requests, driver statuses, history tracking).
- Cloud Functions – where applicable – to process data or triggering push notifications.
- The UI modules in the Android app interact amongst themselves. For example, the Login module directs users to either the Customer or Driver flows.
- The Adapters and Utils within the app help in presenting data (lists, maps, notifications) and handling common tasks (sending notifications, payment processing).

##### Architectural Patterns & Design Principles
- Separation of concerns is evident in the file structure by splitting code into packages like Customer, Driver, Login, Payment, History, and Utils.
- MVC (or an MV*-like) pattern is suggested: Activities/Fragments (UI layer), Adapters/Helpers (presentation logic), and Objects (data models).
- Use of Firebase acts as both the backend and the integration layer to simplify client-server communication.
- The cloud functions are decoupled from the Android front end, showing a microservice-like approach for any custom backend logic.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Android Client App"
        mainAndroid["Main Application"]
        login["Login/Authentication Module"]
        customer["Customer Module"]
        driver["Driver Module"]
        payment["Payment Module"]
        history["History Module"]
        adapters["UI Adapters"]
        utils["Utility Functions"]
    end

    subgraph "Firebase Services"
        firebaseAuth["Firebase Authentication"]
        realtimeDB["Firebase Realtime Database"]
        firebaseStorage["Firebase Storage"]
        cloudFunctions["Firebase Cloud Functions"]
        dbRules["Realtime DB Rules"]
        firebaseConfig["Firebase Config"]
    end

    login -->|"AuthRequests"| firebaseAuth
    customer -->|"RideRequests&Updates"| realtimeDB
    driver -->|"DriverStatusUpdates"| realtimeDB
    payment -->|"Payments"| realtimeDB
    history -->|"RideHistory"| realtimeDB

    customer -->|"DataProcessing"| cloudFunctions
    driver -->|"Notifications"| cloudFunctions
    cloudFunctions -->|"PushNotifs"| login

    dbRules -->|"Configures"| realtimeDB
    firebaseConfig -->|"Configures"| cloudFunctions

    class mainAndroid,login,customer,driver,payment,history,adapters,utils androidStyle
    class firebaseAuth,realtimeDB,firebaseStorage,cloudFunctions,dbRules,firebaseConfig firebaseStyle

    %% Styles
    classDef androidStyle fill:#d0e6ff,stroke:#5b8def,stroke-width:2px;
    classDef firebaseStyle fill:#dfffc6,stroke:#2e8b57,stroke-width:2px;

    %% Click Events
    click mainAndroid "https://github.com/simcoderyoutube/uberclone/tree/master/android/app/src/main/java/com/simcoder/uber"
    click login "https://github.com/simcoderyoutube/uberclone/tree/master/android/app/src/main/java/com/simcoder/uber/Login"
    click customer "https://github.com/simcoderyoutube/uberclone/tree/master/android/app/src/main/java/com/simcoder/uber/Customer"
    click driver "https://github.com/simcoderyoutube/uberclone/tree/master/android/app/src/main/java/com/simcoder/uber/Driver"
    click payment "https://github.com/simcoderyoutube/uberclone/tree/master/android/app/src/main/java/com/simcoder/uber/Payment"
    click history "https://github.com/simcoderyoutube/uberclone/tree/master/android/app/src/main/java/com/simcoder/uber/History"
    click adapters "https://github.com/simcoderyoutube/uberclone/tree/master/android/app/src/main/java/com/simcoder/uber/Adapters"
    click utils "https://github.com/simcoderyoutube/uberclone/tree/master/android/app/src/main/java/com/simcoder/uber/Utils"
    click cloudFunctions "https://github.com/simcoderyoutube/uberclone/tree/master/Firebase_Functions"
    click dbRules "https://github.com/simcoderyoutube/uberclone/blob/master/realtime_database_rules.json"
    click firebaseConfig "https://github.com/simcoderyoutube/uberclone/blob/master/Firebase_Functions/firebase.json"
```
