# gabpa3/puppy-adoption architecture

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

- Interactive diagram: https://gitdiagram.com/gabpa3/puppy-adoption
- Repository: https://github.com/gabpa3/puppy-adoption

## Overview

##### Main Components
- Android Application Shell – Represented by the Gradle build files (build.gradle, settings.gradle, gradlew scripts) and Android manifest within the app module.
- Entry Point & Activity – MainActivity.kt inside the “puppyadoption” package serves as the launch point and orchestrates navigation.
- UI Layer – All UI-related components are organized within the “ui” package. This includes:
⁃ Screens: Home.kt, PuppyDetail.kt, and Shared UI components.
⁃ Navigation: NavRoute.kt which outlines the app’s composable navigation routes.
⁃ Utility & Extension Files: Constants.kt, StringExt.kt, and Util.kt that aid the overall UI logic.
- Data Layer – Located in the “data” package with models such as Puppy.kt and PuppyData.kt. This component holds the core data representation for the Puppies being showcased.
- Testing Suite – Found under app/src/test which includes tests like StringExtKtTest.kt ensuring module reliability.
- CI/CD Integration – GitHub Actions workflows (e.g., .github/workflows/Check.yaml) used for build automation, code formatting, and Spotless/ktlint checks.

##### Relationships and Component Interactions
- The MainActivity acts as the central hub that initializes the app and sets up the Navigation component.
- Navigation (@NavRoute.kt) directs which composable screen (Home or PuppyDetail) is shown based on user interaction.
- The UI layer is built entirely with Compose; these screens retrieve and display data provided from the Data Layer (Puppy and PuppyData) which is likely mocked or statically provided given the app’s scope.
- The Theme and Utility files influence the UI’s appearance and behavior across the app.
- The testing suite validates key UI transformations and utility functions to ensure overall app stability.
- The Gradle build system and CI configurations tie together code formatting (Spotless/ktlint) and build/deployment pipelines.

##### Architectural Patterns and Design Principles
- Declarative UI with Jetpack Compose, promoting a reactive UI design.
- Separation of concerns: The clear division between UI, data models, navigation, and theming ensures maintainability.
- Modular organization: Each package (data, ui, navigation, theme) is logically separated, possibly following an MVVM or clean architecture approach on a smaller scale.
- CI/CD best practices – integration of automated formatting and testing in the development lifecycle.

##### Relevant Technologies and Frameworks
- Jetpack Compose: For building the UI components.
- Android SDK & Kotlin: Fundamental technologies used throughout the app (MainActivity.kt, utility classes).
- Gradle: Build system and dependency manager.
- GitHub Actions: CI/CD pipeline for automated code checks, using workflows defined under .github.
- Spotless & ktlint: Code formatting and linting tools integrated as part of the CI process.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph App["Puppy Adoption Android App"]
        shell["Android Application Shell"]:::infrastructure
        mainActivity["Entry Point: MainActivity.kt"]:::entry
        subgraph UI_Layer["UI Layer"]
            subgraph Screens["Screens"]
                home["Home.kt"]:::screen
                detail["PuppyDetail.kt"]:::screen
                shared["Shared.kt"]:::screen
            end
            nav["Navigation (NavRoute.kt)"]:::navigation
            subgraph Themes["Themes & Styling"]
                theme["Theme.kt"]:::theme
                color["Color.kt"]:::theme
                shape["Shape.kt"]:::theme
                type["Type.kt"]:::theme
            end
            subgraph Utilities["Utilities/Extensions"]
                constants["Constants.kt"]:::utility
                stringExt["StringExt.kt"]:::utility
                util["Util.kt"]:::utility
            end
        end
        subgraph Data["Data Layer"]
            puppy["Puppy.kt"]:::data
            puppyData["PuppyData.kt"]:::data
        end
        testing["Testing Suite"]:::testing
    end
    subgraph CI_CD["CI/CD Integration"]
        workflow["GitHub Actions Workflow"]:::ci
        gradleProps["CI Gradle Properties"]:::ci
    end

    shell --> mainActivity
    mainActivity -->|"initNav"| nav
    nav -->|"navigateTo"| home
    home -->|"selectPuppy"| detail
    themes -->|"applyStyle"| home
    utilities -->|"supportUI"| home
    home -->|"fetchData"| puppy
    home -->|"fetchData"| puppyData
    CI_CD -->|"buildTrigger"| shell
    CI_CD -->|"runTests"| testing

    click shell "https://github.com/gabpa3/puppy-adoption/blob/main/build.gradle"
    click mainActivity "https://github.com/gabpa3/puppy-adoption/blob/main/app/src/main/java/com/gabpa3/puppyadoption/MainActivity.kt"
    click home "https://github.com/gabpa3/puppy-adoption/blob/main/app/src/main/java/com/gabpa3/puppyadoption/ui/screen/Home.kt"
    click detail "https://github.com/gabpa3/puppy-adoption/blob/main/app/src/main/java/com/gabpa3/puppyadoption/ui/screen/PuppyDetail.kt"
    click shared "https://github.com/gabpa3/puppy-adoption/blob/main/app/src/main/java/com/gabpa3/puppyadoption/ui/screen/Shared.kt"
    click nav "https://github.com/gabpa3/puppy-adoption/blob/main/app/src/main/java/com/gabpa3/puppyadoption/ui/navigation/NavRoute.kt"
    click theme "https://github.com/gabpa3/puppy-adoption/blob/main/app/src/main/java/com/gabpa3/puppyadoption/ui/theme/Theme.kt"
    click color "https://github.com/gabpa3/puppy-adoption/blob/main/app/src/main/java/com/gabpa3/puppyadoption/ui/theme/Color.kt"
    click shape "https://github.com/gabpa3/puppy-adoption/blob/main/app/src/main/java/com/gabpa3/puppyadoption/ui/theme/Shape.kt"
    click type "https://github.com/gabpa3/puppy-adoption/blob/main/app/src/main/java/com/gabpa3/puppyadoption/ui/theme/Type.kt"
    click constants "https://github.com/gabpa3/puppy-adoption/blob/main/app/src/main/java/com/gabpa3/puppyadoption/ui/Constants.kt"
    click stringExt "https://github.com/gabpa3/puppy-adoption/blob/main/app/src/main/java/com/gabpa3/puppyadoption/ui/StringExt.kt"
    click util "https://github.com/gabpa3/puppy-adoption/blob/main/app/src/main/java/com/gabpa3/puppyadoption/ui/Util.kt"
    click puppy "https://github.com/gabpa3/puppy-adoption/blob/main/app/src/main/java/com/gabpa3/puppyadoption/data/Puppy.kt"
    click puppyData "https://github.com/gabpa3/puppy-adoption/blob/main/app/src/main/java/com/gabpa3/puppyadoption/data/PuppyData.kt"
    click test "https://github.com/gabpa3/puppy-adoption/blob/main/app/src/test/java/com/gabpa3/puppyadoption/ui/StringExtKtTest.kt"
    click workflow "https://github.com/gabpa3/puppy-adoption/blob/main/.github/workflows/Check.yaml"
    click gradleProps "https://github.com/gabpa3/puppy-adoption/blob/main/.github/ci-gradle.properties"

    classDef infrastructure fill:#d3d3d3,stroke:#333,stroke-width:2px;
    classDef entry fill:#ffd700,stroke:#333,stroke-width:2px;
    classDef ui fill:#87cefa,stroke:#333,stroke-width:2px;
    classDef data fill:#ffa07a,stroke:#333,stroke-width:2px;
    classDef testing fill:#dda0dd,stroke:#333,stroke-width:2px;
    classDef ci fill:#90ee90,stroke:#333,stroke-width:2px;
    classDef navigation fill:#add8e6,stroke:#333,stroke-width:2px;
    classDef theme fill:#b0e0e6,stroke:#333,stroke-width:2px;
    classDef utility fill:#e6e6fa,stroke:#333,stroke-width:2px;
    classDef screen fill:#87ceeb,stroke:#333,stroke-width:2px;
```
