# baudelioandalon/ultimatetest architecture

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

- Interactive diagram: https://gitdiagram.com/baudelioandalon/ultimatetest
- Repository: https://github.com/baudelioandalon/ultimatetest

## Overview

##### Project type and purpose
- This is a multi-module Android application built with Kotlin & Jetpack Compose.
- It follows Clean Architecture and MVVM, with two main feature sets:
– FreeToGames (modules/games)
– RickAndMorty (modules/rickandmorty)
- There are two shared libraries:
– library/core: core domain logic, base ViewModels, UI helpers, networking abstractions

##### File structure and highlight architectural choices
- app/ – Android application entry point (MainActivity, Application class, navigation graph)
- modules/games/ and modules/rickandmorty/ – feature modules, each with:
– domain layer (use-cases, models, repository interfaces, navigation definitions)
– data layer (Retrofit/Ktor data sources, Room local datasource, repositories)
– presentation layer (ViewModels + Compose UI screens: Welcome, Home, Details, Edit)
– di packages – Modules that wire up ApiModule, RepositoryModule, UseCaseModule, DatabaseModule
- library/core/ – shared domain abstractions and networking wrapper (Ktor core, ApiResponse, StateApi)
- library/uisystem/ – shared UI components and theming
- buildSrc/ – centralized Gradle configuration (Dependency.kt, Version.kt, AndroidConfig.kt)

##### Extract insights from the README
- Core technologies: Kotlin Serialization, Hilt-style DI (custom modules), Jetpack Compose, Ktor, Room, Coil, Coroutines.
- Workflows:
– On startup, show a welcome screen.
– Navigate via bottom nav to feature screens (Games or RickAndMorty).
– Each feature fetches paginated JSON from its API, persists to Room, displays via LazyColumn or LazyRow.
– Detail and edit workflows update local DB and re-display.
– Offline support: if no Internet, read from Room; on reconnect, resume API calls.

1. Android Client (app module)
2. Feature Modules (games, rickandmorty)
3. Shared Libraries (core, uisystem)
4. Network Engine (Ktor Core wrapper in library/core)
5. Local Storage (Room database)
6. External Services (FreeToGames API, RickAndMorty API)
- UI layer (Compose screens in app and feature modules) → ViewModel (presentation)
- ViewModel → UseCase (domain layer)
- UseCase → Repository (data layer)
- Repository → { RemoteDataSource (Ktor) ↔ External API ; LocalDataSource (Room) }
- DI Modules tie ViewModel, UseCase, Repository, DataSources together
- Shared libraries (core, uisystem) are dependencies of both feature modules and app
c. Architectural patterns & principles:
- Clean Architecture tri-layer separation: Presentation / Domain / Data
- MVVM pattern in each feature
- Single Activity + Compose navigation graph
- Dependency Injection via manual DI modules (Hilt-style)
- Offline-first approach: fallback from remote to local
d. Technologies & frameworks (annotate each component):
- Kotlin + Coroutines for concurrency
- Jetpack Compose for UI
- Ktor (core wrapper) for network calls
- Room for persistence
- Coil for image loading
- Kotlin Serialization for JSON mapping

##### Detail is key
- Within each feature, show the three Clean Architecture layers.
- Clearly call out the DI modules that connect layers.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Android Client
    subgraph "Android Client (app)" 
        direction TB
        MainActivity["MainActivity\n(Compose Nav)"]:::presentation
        CustomBottomNav["CustomBottomNavigation"]:::presentation
        Theme["Theme"]:::presentation
    end

    %% Shared Libraries
    subgraph "Shared Libraries" 
        direction TB
        CoreLib["core\n(Network, BaseVM, UI Helpers)"]:::shared
        UISys["uisystem\n(Compose Components, Theme)"]:::shared
    end

    %% Games Feature Module
    subgraph "Games Module" 
        direction TB
        subgraph "Presentation" 
            direction TB
            GamesUI["HomeGamesViewCompose"]:::presentation
            GamesVM["HomeGamesViewModel"]:::presentation
        end
        subgraph "Domain" 
            direction TB
            GetListGamesUC["GetListGamesUseCase"]:::domain
            EndpointsGames["EndpointsGames"]:::domain
        end
        subgraph "Data" 
            direction TB
            RepoGames["GamesRepositoryImpl"]:::data
            RemoteGamesDS["ExecuteGetGamesListDataSource"]:::data
            LocalGamesDS["GamesDao\n& AppDatabase"]:::data
        end
    end

    %% RickAndMorty Feature Module
    subgraph "RickAndMorty Module" 
        direction TB
        subgraph "Presentation" 
            direction TB
            RMUI["HomeViewCompose"]:::presentation
            RMVM["HomeViewModel"]:::presentation
        end
        subgraph "Domain" 
            direction TB
            GetListEpisodesUC["GetListEpisodesUseCase"]:::domain
            EndpointsRM["Endpoints"]:::domain
        end
        subgraph "Data" 
            direction TB
            RepoRM["RickAndMortyRepositoryImpl"]:::data
            RemoteRMDs["ExecuteGetListEpisodesDataSource"]:::data
            LocalRMDs["RickAndMortyDao\n& AppDatabase"]:::data
        end
    end

    %% External Systems
    FreeToGamesAPI["FreeToGames API"]:::external
    RickAndMortyAPI["RickAndMorty API"]:::external
    RoomDB["Room Database"]:::external

    %% Build Config
    BuildSrc["buildSrc\n(Gradle Config)"]:::build

    %% Connections
    MainActivity -->|navigates to| GamesUI
    MainActivity -->|navigates to| RMUI
    CustomBottomNav --> GamesUI
    CustomBottomNav --> RMUI

    GamesUI -->|calls| GamesVM
    GamesVM -->|uses| GetListGamesUC
    GetListGamesUC -->|calls| RepoGames
    RepoGames -->|fetches| RemoteGamesDS
    RepoGames -->|caches| LocalGamesDS
    RemoteGamesDS -->|HTTP| FreeToGamesAPI
    LocalGamesDS -->|SQL| RoomDB

    RMUI -->|calls| RMVM
    RMVM -->|uses| GetListEpisodesUC
    GetListEpisodesUC -->|calls| RepoRM
    RepoRM -->|fetches| RemoteRMDs
    RepoRM -->|caches| LocalRMDs
    RemoteRMDs -->|HTTP| RickAndMortyAPI
    LocalRMDs -->|SQL| RoomDB

    %% Shared Lib Dependencies
    CoreLib --> GamesVM
    CoreLib --> RMVM
    CoreLib --> GetListGamesUC
    CoreLib --> GetListEpisodesUC
    UISys --> GamesUI
    UISys --> RMUI
    UISys --> MainActivity
    UISys --> CustomBottomNav
    CoreLib --> RemoteGamesDS
    CoreLib --> RemoteRMDs

    BuildSrc -->|configures| CoreLib
    BuildSrc -->|configures| UISys
    BuildSrc -->|configures| app
    BuildSrc -->|configures| modules

    %% Click Events
    click AndroidClient "https://github.com/baudelioandalon/ultimatetest/tree/main/app/"
    click GamesModule "https://github.com/baudelioandalon/ultimatetest/tree/main/modules/games/"
    click RickAndMortyModule "https://github.com/baudelioandalon/ultimatetest/tree/main/modules/rickandmorty/"
    click CoreLib "https://github.com/baudelioandalon/ultimatetest/tree/main/library/core/"
    click UISys "https://github.com/baudelioandalon/ultimatetest/tree/main/library/uisystem/"
    click ApiResponse "https://github.com/baudelioandalon/ultimatetest/blob/main/library/core/src/main/java/com/boreal/ultimatetest/core/domain/network/ApiResponse.kt"
    click StateApi "https://github.com/baudelioandalon/ultimatetest/blob/main/library/core/src/main/java/com/boreal/ultimatetest/core/domain/network/StateApi.kt"
    click ApiModule "https://github.com/baudelioandalon/ultimatetest/blob/main/library/core/src/main/java/com/boreal/ultimatetest/core/di/ApiModule.kt"
    click AppDatabase "https://github.com/baudelioandalon/ultimatetest/blob/main/modules/games/src/main/java/com/boreal/ultimatetest/games/domain/interfaces/AppDatabase.kt"
    click GamesDao "https://github.com/baudelioandalon/ultimatetest/blob/main/modules/games/src/main/java/com/boreal/ultimatetest/games/domain/interfaces/GamesDao.kt"
    click DatabaseModule "https://github.com/baudelioandalon/ultimatetest/blob/main/modules/games/src/main/java/com/boreal/ultimatetest/games/di/DatabaseModule.kt"
    click DataSourceGamesModule "https://github.com/baudelioandalon/ultimatetest/blob/main/modules/games/src/main/java/com/boreal/ultimatetest/games/di/DataSourceGamesModule.kt"
    click GamesApiModule "https://github.com/baudelioandalon/ultimatetest/blob/main/modules/games/src/main/java/com/boreal/ultimatetest/games/di/GamesApiModule.kt"
    click RepositoryGamesModule "https://github.com/baudelioandalon/ultimatetest/blob/main/modules/games/src/main/java/com/boreal/ultimatetest/games/di/RepositoryGamesModule.kt"
    click UseCaseGamesModule "https://github.com/baudelioandalon/ultimatetest/blob/main/modules/games/src/main/java/com/boreal/ultimatetest/games/di/UseCaseGamesModule.kt"
    click RickAndMortyApiModule "https://github.com/baudelioandalon/ultimatetest/blob/main/modules/rickandmorty/src/main/java/com/boreal/ultimatetest/rickandmorty/di/RickAndMortyApiModule.kt"
    click DataSourceModuleRM "https://github.com/baudelioandalon/ultimatetest/blob/main/modules/rickandmorty/src/main/java/com/boreal/ultimatetest/rickandmorty/di/DataSourceModule.kt"
    click RepositoryModuleRM "https://github.com/baudelioandalon/ultimatetest/blob/main/modules/rickandmorty/src/main/java/com/boreal/ultimatetest/rickandmorty/di/RepositoryModule.kt"
    click UseCaseModuleRM "https://github.com/baudelioandalon/ultimatetest/blob/main/modules/rickandmorty/src/main/java/com/boreal/ultimatetest/rickandmorty/di/UseCaseModule.kt"
    click MainActivity "https://github.com/baudelioandalon/ultimatetest/blob/main/app/src/main/java/com/boreal/ultimatetest/presentation/ui/MainActivity.kt"
    click CustomBottomNav "https://github.com/baudelioandalon/ultimatetest/blob/main/app/src/main/java/com/boreal/ultimatetest/ui/components/bottomnavigation/CustomBottomNavigation.kt"
    click Theme "https://github.com/baudelioandalon/ultimatetest/blob/main/app/src/main/java/com/boreal/ultimatetest/ui/theme/Theme.kt"
    click GamesUI "https://github.com/baudelioandalon/ultimatetest/blob/main/modules/games/src/main/java/com/boreal/ultimatetest/games/modules/home/presentation/ui/HomeGamesViewCompose.kt"
    click GamesVM "https://github.com/baudelioandalon/ultimatetest/blob/main/modules/games/src/main/java/com/boreal/ultimatetest/games/modules/home/viewmodel/HomeGamesViewModel.kt"
    click RMUI "https://github.com/baudelioandalon/ultimatetest/blob/main/modules/rickandmorty/src/main/java/com/boreal/ultimatetest/rickandmorty/modules/home/presentation/ui/HomeViewCompose.kt"
    click RMVM "https://github.com/baudelioandalon/ultimatetest/blob/main/modules/rickandmorty/src/main/java/com/boreal/ultimatetest/rickandmorty/modules/home/viewmodel/HomeViewModel.kt"
    click GetListGamesUC "https://github.com/baudelioandalon/ultimatetest/blob/main/modules/games/src/main/java/com/boreal/ultimatetest/games/domain/use_cases/GetListGamesUseCase.kt"
    click GetListEpisodesUC "https://github.com/baudelioandalon/ultimatetest/blob/main/modules/rickandmorty/src/main/java/com/boreal/ultimatetest/rickandmorty/modules/episodes/domain/use_cases/GetListEpisodesUseCase.kt"
    click EndpointsGames "https://github.com/baudelioandalon/ultimatetest/blob/main/modules/games/src/main/java/com/boreal/ultimatetest/games/domain/model/EndpointsGames.kt"
    click EndpointsRM "https://github.com/baudelioandalon/ultimatetest/blob/main/modules/rickandmorty/src/main/java/com/boreal/ultimatetest/rickandmorty/domain/model/Endpoints.kt"
    click RemoteGamesDS "https://github.com/baudelioandalon/ultimatetest/blob/main/modules/games/src/main/java/com/boreal/ultimatetest/games/modules/home/data/data_source/remote/ExecuteGetGamesListDataSource.kt"
    click RemoteRMDs "https://github.com/baudelioandalon/ultimatetest/blob/main/modules/rickandmorty/src/main/java/com/boreal/ultimatetest/rickandmorty/modules/episodes/data/data_source/remote/ExecuteGetListEpisodesDataSource.kt"
    click BuildSrc "https://github.com/baudelioandalon/ultimatetest/tree/main/buildSrc/"

    %% Styles
    classDef presentation fill:#D0E8FF,stroke:#005B96,stroke-width:1px
    classDef domain fill:#FFF4C1,stroke:#BD8B00,stroke-width:1px
    classDef data fill:#D8F5D3,stroke:#3D6B35,stroke-width:1px
    classDef external fill:#E0E0E0,stroke:#888888,stroke-width:1px,stroke-dasharray: 4 2
    classDef shared fill:#F0F0F0,stroke:#666666,stroke-width:1px,stroke-dasharray: 4 2
    classDef build fill:#FFE0E0,stroke:#A00000,stroke-width:1px,stroke-dasharray: 4 2
```
