# api-tologists/elearning-mobile-app architecture

> Architecture diagram of the GitHub repository api-tologists/elearning-mobile-app, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/api-tologists/elearning-mobile-app
- Repository: https://github.com/api-tologists/elearning-mobile-app

## Overview

##### Project type and purpose
- This is a full-stack Android mobile application (“eLearning-Mobile-App”) written in Kotlin, using Jetpack Compose for the UI and Firebase for its backend (Auth, Firestore, Storage).
- It lets students sign up, browse and progress through courses, take quizzes, get certificates; it also lets instructors create and manage course content. It optionally integrates Google Generative AI (Gemini) to enhance content or recommendations.

##### File structure
- Top-level: `app/` contains an Android Studio Gradle project.
- Under `app/src/main/java/com/example/elearning/`:
- `ui/` (Compose components & screens)
- `viewmodel/` (MVVM ViewModels)
- `repository/` (data access abstractions)
- `service/` (Firebase & AI SDK clients, notification & payment logic)
- `local/` (Room database & DAO)
- `model/` (data classes)
- `navigation/` (NavGraph & screen definitions)
- `util/` (PDF generation, network utilities)
- Standard Android resource directories and Gradle wrappers/config.

##### README
- Confirms Kotlin, Jetpack Compose, Firebase Auth & Firestore, Storage, and Google Generative AI SDK.
- Describes student and instructor use-cases, setup steps, and required configuration files (`google-services.json`, API key template).

##### Detail
- Call out authentication flow separately: AuthViewModel → Firebase Auth → obtain token → used by Firestore and Storage
- NotificationService subscribing to user actions and pushing to Firebase Cloud Messaging if relevant

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Android App"
        direction TB

        subgraph "Application Entry"
            App["ELearningApplication\nMainActivity"]:::app
        end

        subgraph "UI & Navigation Layer"
            direction TB
            UIComponents["UI Components"]:::ui
            UIScreens["UI Screens"]:::ui
            UITheme["UI Theme"]:::ui
            NavGraph["NavGraph\nScreen Definitions"]:::ui
        end

        subgraph "Presentation Layer"
            direction TB
            ViewModels["ViewModels"]:::business
        end

        subgraph "Domain/Data Layer"
            direction TB
            Repositories["Repositories"]:::business
        end

        subgraph "Service Layer"
            direction TB
            GeminiService["GeminiService"]:::data
            NotificationService["NotificationService"]:::data
            PaymentService["PaymentService"]:::data
            UserActivityTracker["UserActivityTracker"]:::data
        end

        subgraph "Local Storage Layer"
            direction TB
            AppDatabase["AppDatabase"]:::data
            CourseDao["CourseDao"]:::data
            CourseEntity["CourseEntity"]:::data
        end

        subgraph "Support Components"
            direction TB
            Models["Data Models"]:::data
            Utils["Utilities"]:::data
        end

        %% Interactions
        UIComponents -->|"user events"| ViewModels
        UIScreens --> ViewModels
        UITheme --> ViewModels
        NavGraph --> UIScreens

        ViewModels -->|"fetch/save data"| Repositories
        Repositories -->|"choose source"| AppDatabase
        Repositories -->|"choose source"| GeminiService
        Repositories -->|"choose source"| NotificationService
        Repositories -->|"choose source"| PaymentService

        GeminiService -->|"call AI API"| ExternalGemini
        NotificationService -->|"send notifications"| ExternalFCM
        PaymentService -->|"process payments"| ExternalPayments

        Repositories -->|"cache|remote"| CourseDao
        CourseDao --> CourseEntity

        App --> UIComponents
        App --> ViewModels
        App --> Repositories

        Models --> Repositories
        Utils --> ViewModels
    end

    subgraph "External Services"
        direction TB
        ExternalAuth["Firebase Auth"]:::ext
        ExternalFirestore["Cloud Firestore"]:::ext
        ExternalStorage["Firebase Storage"]:::ext
        ExternalGemini["Google Gemini API"]:::ext
        ExternalFCM["Firebase Cloud Messaging"]:::ext
        ExternalPayments["Payment Gateway"]:::ext
    end

    %% Service to Firebase
    NotificationService --> ExternalAuth
    PaymentService --> ExternalAuth
    Repositories --> ExternalFirestore
    Repositories --> ExternalStorage
    GeminiService --> ExternalGemini

    %% Click Events
    click UIComponents "https://github.com/api-tologists/elearning-mobile-app/tree/main/app/src/main/java/com/example/elearning/ui/components"
    click UIScreens "https://github.com/api-tologists/elearning-mobile-app/tree/main/app/src/main/java/com/example/elearning/ui/screens"
    click UITheme "https://github.com/api-tologists/elearning-mobile-app/tree/main/app/src/main/java/com/example/elearning/ui/theme"
    click NavGraph "https://github.com/api-tologists/elearning-mobile-app/blob/main/app/src/main/java/com/example/elearning/navigation/NavGraph.kt"
    click ViewModels "https://github.com/api-tologists/elearning-mobile-app/tree/main/app/src/main/java/com/example/elearning/viewmodel"
    click Repositories "https://github.com/api-tologists/elearning-mobile-app/tree/main/app/src/main/java/com/example/elearning/repository"
    click GeminiService "https://github.com/api-tologists/elearning-mobile-app/blob/main/app/src/main/java/com/example/elearning/service/GeminiService.kt"
    click NotificationService "https://github.com/api-tologists/elearning-mobile-app/blob/main/app/src/main/java/com/example/elearning/service/NotificationService.kt"
    click PaymentService "https://github.com/api-tologists/elearning-mobile-app/blob/main/app/src/main/java/com/example/elearning/service/PaymentService.kt"
    click UserActivityTracker "https://github.com/api-tologists/elearning-mobile-app/blob/main/app/src/main/java/com/example/elearning/service/UserActivityTracker.kt"
    click AppDatabase "https://github.com/api-tologists/elearning-mobile-app/blob/main/app/src/main/java/com/example/elearning/local/AppDatabase.kt"
    click CourseDao "https://github.com/api-tologists/elearning-mobile-app/blob/main/app/src/main/java/com/example/elearning/local/CourseDao.kt"
    click CourseEntity "https://github.com/api-tologists/elearning-mobile-app/blob/main/app/src/main/java/com/example/elearning/local/CourseEntity.kt"
    click Models "https://github.com/api-tologists/elearning-mobile-app/tree/main/app/src/main/java/com/example/elearning/model"
    click Utils "https://github.com/api-tologists/elearning-mobile-app/blob/main/app/src/main/java/com/example/elearning/util/CertificatePdfGenerator.kt"
    click Utils "https://github.com/api-tologists/elearning-mobile-app/blob/main/app/src/main/java/com/example/elearning/utils/NetworkUtils.kt"
    click App "https://github.com/api-tologists/elearning-mobile-app/blob/main/app/src/main/java/com/example/elearning/ELearningApplication.kt"
    click App "https://github.com/api-tologists/elearning-mobile-app/blob/main/app/src/main/java/com/example/elearning/MainActivity.kt"
    click ExternalAuth "https://github.com/api-tologists/elearning-mobile-app/blob/main/app/google-services.json"

    %% Styles
    classDef ui fill:#D0E8FF,stroke:#0366D6,color:#003366
    classDef business fill:#DFF4DF,stroke:#22863A,color:#0C2D10
    classDef data fill:#FFF5D1,stroke:#DBAB09,color:#735C0F
    classDef ext fill:#FBEFF2,stroke:#E5534B,color:#611A15
    classDef app fill:#E8F0FE,stroke:#1967D2,color:#174EA6
```
