# glantrox/attendance_app architecture

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

- Interactive diagram: https://gitdiagram.com/glantrox/attendance_app
- Repository: https://github.com/glantrox/attendance_app

## Overview

- Mobile Frontend (Android App) – This is the primary interface where teachers and students interact. It consists of various Activities (e.g., LoginActivity, RegisterActivity, DashboardActivity, AttendanceActivity, etc.), Fragments (e.g., FragmentDetailAbsen, Fragment_Check_In layout), and Adapters (e.g., AdapterAttendance, KaryawanAdapter). These can be grouped under “Presentation Layer.”
- Business Logic & Local Data Management – Represent the classes handling shared preferences, and other client-side logic (e.g., SharedPreferences.kt), along with helper classes in the “model” package that define data structures for Attendance, Login responses, etc.
- External Backend Services – Represent Supabase as the primary backend API component. Also include external integrations like the Imgur API which is used for uploading attendance and profile pictures.

##### Relationships and Interactions
- Mobile UI Components communicate directly with the Business Logic layer.
- Business Logic uses Model classes and interacts with the Data Access layer to fetch or update attendance data.
- The Data Access layer, via the SupabaseApi, communicates with the Supabase server component.

##### Architectural Patterns and Design Principles
- The file structure suggests a separation of concerns, potentially following an MVP/MVVM pattern. Emphasize the separation between UI (Activities/Fragments), business logic, and data access.
- Mention modularization – the clear division between presentation (UI and layouts), domain (logic and models), and data (API handling) layers.
- Marking external dependencies (Supabase and Imgur) separately.

##### Relevant Technologies, Frameworks, and Libraries
- Kotlin as the programming language.
- Android Studio’s platform-specific components (Activities, Fragments, Adapters).
- Supabase API for backend services.
- Imgur API for managing attendance images.
- Gradle for build automation.
- Google services (notice the google-services.json file) which also indicates integration with Firebase/Google APIs for additional functionalities.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Presentation Layer"
        PF1["LoginActivity (UI)"]:::presentation
        PF2["RegisterActivity (UI)"]:::presentation
        PF3["DashboardActivity (UI)"]:::presentation
        PF4["AttendanceActivity (UI)"]:::presentation
        PF5["ListKaryawanActivity (UI)"]:::presentation
        PF6["NoConnectionActivity (UI)"]:::presentation
        PF7["SettingsActivity (UI)"]:::presentation
        PF8["StartActivity (UI)"]:::presentation
        PF9["UpdateActivity (UI)"]:::presentation
        FR1["FragmentDetailAbsen (UI)"]:::presentation
        AD1["AdapterAttendance (UI)"]:::presentation
        AD2["KaryawanAdapter (UI)"]:::presentation
        UI_LAYOUT["Layout Files (UI)"]:::presentation
    end

    subgraph "Business Logic & Local Data Management"
        BL1["SharedPreferences (Logic)"]:::business
        BL2["Model Classes (Logic)"]:::business
    end

    subgraph "Data Access & API Integration"
        DA1["SupabaseApi (Data Access)"]:::dataaccess
    end

    subgraph "External Backend Services"
        EX1["Supabase (Backend)"]:::external
        EX2["Imgur API (External)"]:::external
    end

    subgraph "Infrastructure & Configuration"
        INF1["Build & Config Files"]:::infrastructure
        INF2["Google Services Config"]:::infrastructure
        INF3["Resource Files"]:::infrastructure
    end

    %% Relationships between layers (vertical flow)
    PF1 -->|"calls"| BL1
    PF1 -->|"auth"| DA1
    PF2 -->|"registersUser"| DA1
    PF3 -->|"fetchesAttendance"| DA1
    PF4 -->|"checkInOut"| DA1
    PF5 -->|"listEmployees"| DA1
    PF6 -->|"handleNetwork"| BL1
    PF7 -->|"updateSettings"| BL1
    FR1 -->|"displayDetails"| PF3
    AD1 -->|"renderAttendance"| PF4
    AD2 -->|"renderEmployeeList"| PF5
    UI_LAYOUT -->|"rendersUI"| PF1

    BL1 -->|"readWritePrefs"| BL2
    BL2 -->|"provideModelData"| DA1
    DA1 -->|"communicatesWith"| EX1
    DA1 -->|"uploadsImagesTo"| EX2

    %% Infrastructure supports various layers
    INF1 -.-> PF1
    INF1 -.-> BL1
    INF1 -.-> DA1
    INF2 -.-> PF1
    INF3 -.-> UI_LAYOUT

    %% Click Events - Presentation Layer
    click PF1 "https://github.com/glantrox/attendance_app/blob/master/app/src/main/java/com/example/aplikasi_absen/LoginActivity.kt"
    click PF2 "https://github.com/glantrox/attendance_app/blob/master/app/src/main/java/com/example/aplikasi_absen/RegisterActivity.kt"
    click PF3 "https://github.com/glantrox/attendance_app/blob/master/app/src/main/java/com/example/aplikasi_absen/DashboardActivity.kt"
    click PF4 "https://github.com/glantrox/attendance_app/blob/master/app/src/main/java/com/example/aplikasi_absen/AttendanceActivity.kt"
    click PF5 "https://github.com/glantrox/attendance_app/blob/master/app/src/main/java/com/example/aplikasi_absen/ListKaryawanActivity.kt"
    click PF6 "https://github.com/glantrox/attendance_app/blob/master/app/src/main/java/com/example/aplikasi_absen/NoConnectionActivity.kt"
    click PF7 "https://github.com/glantrox/attendance_app/blob/master/app/src/main/java/com/example/aplikasi_absen/SettingsActivity.kt"
    click PF8 "https://github.com/glantrox/attendance_app/blob/master/app/src/main/java/com/example/aplikasi_absen/StartActivity.kt"
    click PF9 "https://github.com/glantrox/attendance_app/blob/master/app/src/main/java/com/example/aplikasi_absen/UpdateActivity.kt"
    click FR1 "https://github.com/glantrox/attendance_app/blob/master/app/src/main/java/com/example/aplikasi_absen/FragmentDetailAbsen.kt"
    click AD1 "https://github.com/glantrox/attendance_app/blob/master/app/src/main/java/com/example/aplikasi_absen/AdapterAttendance.kt"
    click AD2 "https://github.com/glantrox/attendance_app/blob/master/app/src/main/java/com/example/aplikasi_absen/KaryawanAdapter.kt"
    click UI_LAYOUT "https://github.com/glantrox/attendance_app/tree/master/app/src/main/res/layout"

    %% Click Events - Business Logic & Data Management
    click BL1 "https://github.com/glantrox/attendance_app/blob/master/app/src/main/java/com/example/aplikasi_absen/SharedPreferences.kt"
    click BL2 "https://github.com/glantrox/attendance_app/tree/master/app/src/main/java/com/example/aplikasi_absen/model"

    %% Click Events - Data Access
    click DA1 "https://github.com/glantrox/attendance_app/blob/master/app/src/main/java/com/example/aplikasi_absen/database/SupabaseApi.kt"

    %% Click Events - Infrastructure
    click INF1 "https://github.com/glantrox/attendance_app/blob/master/app/build.gradle"
    click INF2 "https://github.com/glantrox/attendance_app/blob/master/app/google-services.json"
    click INF3 "https://github.com/glantrox/attendance_app/tree/master/app/src/main/res"

    %% Styling Definitions
    classDef presentation fill:#f9f,stroke:#333,stroke-width:2px;
    classDef business fill:#ccf,stroke:#333,stroke-width:2px;
    classDef dataaccess fill:#cfc,stroke:#333,stroke-width:2px;
    classDef external fill:#fcc,stroke:#333,stroke-width:2px;
    classDef infrastructure fill:#fcf,stroke:#333,stroke-width:2px;
```
