# thiagosgomes-dev/onde-fica architecture

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

- Interactive diagram: https://gitdiagram.com/thiagosgomes-dev/onde-fica
- Repository: https://github.com/thiagosgomes-dev/onde-fica

## Overview

##### Main Components
- UI Layer – Represented mainly by the Jetpack Compose screens, themes, and view components. In the file structure, these are within app/src/main/java/br/com/alura/ondefica/ui (subfolders for screens, theme, etc.). This layer is responsible for presenting the address search interface to the user.
- ViewModel Layer – The app/src/main/java/br/com/alura/ondefica/ui/viewmodels folder contains the AddressViewModel, which manages the state of the UI and handles business logic for address search functionality.
- Dependency Injection – Koin is used to wire dependencies. Represent this as a separate module that configures and provides dependencies (ViewModels, network clients, etc.).
- Android Framework – Represent the Android system components such as MainActivity (the entry point defined in MainActivity.kt) and the AndroidManifest.xml which configures application-level settings. Although not a “module” in your own code, it plays a crucial role as the integration point for all the layers.

##### Relationships and Interactions
- The UI screens interact with the ViewModel (AddressViewModel), so indicate directional data flow and event handlers from UI to ViewModel.
- Koin ties the ViewModel, networking client, and other dependencies together. Illustrate Koin as an underlying framework that “injects” dependencies into the various layers. Use an annotation or a separate layer to indicate dependency management.

##### Architectural Patterns and Design Principles
- MVVM (Model-View-ViewModel): Clearly emphasize that the system’s core architectural pattern separates the UI (View/Compose functions) and ViewModel (business logic and state) while abstracting data retrieval behind the network/service layer.
- Dependency Injection: Show that Koin configuration is central to the instantiation and wiring of components, illustrating decoupling and testability.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Android Framework Subgraph
    subgraph "Android Framework"
        MA["MainActivity (Entry Point)"]:::android
        AM["Android Manifest (Configuration)"]:::android
    end

    %% UI Layer Subgraph
    subgraph "UI Layer"
        UIS["UI Screens (Jetpack Compose)"]:::ui
        UIT["UI Theme & Components"]:::ui
    end

    %% Business Logic / ViewModel
    subgraph "Business Logic"
        VM["ViewModel (AddressViewModel)"]:::viewmodel
    end

    %% Network and Dependency Injection Subgraph
    subgraph "Network & DI"
        NC["Network Client (Ktor/Retrofit)"]:::network
        DI["Dependency Injection (Koin)"]:::di
    end

    %% Connections
    MA -->|"hosts"| UIS
    MA -->|"hosts"| UIT
    UIS -->|"triggers"| VM
    VM -->|"calls"| NC
    NC -->|"returns"| VM
    VM -->|"updates"| UIS

    %% Dependency Injection dotted relationships
    DI -.-> VM
    DI -.-> NC

    %% Styling
    classDef android fill:#f6d186,stroke:#cd853f,stroke-width:2px;
    classDef ui fill:#add8e6,stroke:#4682b4,stroke-width:2px;
    classDef viewmodel fill:#90ee90,stroke:#32cd32,stroke-width:2px;
    classDef network fill:#ffcccb,stroke:#e9967a,stroke-width:2px;
    classDef di fill:#dda0dd,stroke:#ba55d3,stroke-width:2px;

    %% Click Events
    click UIS "https://github.com/thiagosgomes-dev/onde-fica/tree/main/app/src/main/java/br/com/alura/ondefica/ui/screens"
    click UIT "https://github.com/thiagosgomes-dev/onde-fica/tree/main/app/src/main/java/br/com/alura/ondefica/ui/theme"
    click VM "https://github.com/thiagosgomes-dev/onde-fica/blob/main/app/src/main/java/br/com/alura/ondefica/ui/viewmodels/AddressViewModel.kt"
    click MA "https://github.com/thiagosgomes-dev/onde-fica/blob/main/app/src/main/java/br/com/alura/ondefica/MainActivity.kt"
    click AM "https://github.com/thiagosgomes-dev/onde-fica/blob/main/app/src/main/AndroidManifest.xml"
```
