# nicosnicolaou16/pokedex_compose_xr architecture

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

- Interactive diagram: https://gitdiagram.com/nicosnicolaou16/pokedex_compose_xr
- Repository: https://github.com/nicosnicolaou16/pokedex_compose_xr

## Overview

##### Project Type & Purpose
- This is a single-module Android mobile application (app/) that serves as an XR-enabled Pokédex.
- Built with Jetpack Compose for UI, AndroidX XR for AR/VR functionality, MVVM + Repository for architecture, Hilt for DI, Retrofit for network, and Room for local persistence.

##### File Structure & Architectural Layers
- Top-level “app” module contains everything.
- Layer breakdown:
a. presentation/ – Compose screens, ViewModels, MainActivity
b. domain/ – repository interfaces, data models, network service interfaces, DI modules for network & error handling
c. data/ – repository implementations, mappers, Room database (entities, DAOs, database init, type converters), DI modules for database
e. utils/ – extensions, Resource & HandlingError wrappers, screen routing

##### Key Components
- UI Layer:
- MainActivity & Composable Screens (PokemonListScreen, PokemonDetailsScreen, GenericViews)
- Jetpack Compose & AndroidX XR UI sub-framework
- Presentation Layer:
- ViewModels (PokemonListViewModel, PokemonDetailsViewModel)
- UIState classes (loading, loaded, error)
- Domain Layer:
- Repository interfaces (PokemonListRepository, PokemonDetailsRepository)
- Network interfaces (PokemonService, MyNetworkManager)
- Models (PokemonResponse, PokemonDetailsDataModel, UI models)
- DI Modules (NetworkModules, PokemonModule, HandlingErrorModule)
- Data Layer:
- RepositoryImpl classes (PokemonListRepositoryImpl, PokemonDetailsRepositoryImpl)
- Mappers (PokemonDetailsMapper)
- Retrofit client & service bindings
- Room Database: MyRoomDatabase, Entities & DAOs
- TypeConverters
- DI Modules (MyRoomDatabaseModule)
- External Systems & Libraries:
- AndroidX XR Library (AR/VR runtime & UI extensions)
- Retrofit (HTTP client)
- Room (SQLite ORM)
- Coil (image loading)
- Hilt (DI)
- KSP (code generation)
- R8 (code shrinker)

##### Relationships & Data Flows
- UI → ViewModel: user events & state observers
- ViewModel → Repository interface (injected via Hilt)
- RepositoryImpl →
- Network path: Retrofit → PokemonService → maps JSON → domain models
- Cache path: Room DAOs → Entities ↔ domain models via mappers
- Domain models → ViewModels → UI models → Composables
- DI graph: Hilt modules wire MyNetworkManager & Retrofit service into repositories; MyRoomDatabaseModule provides DAOs.
- XR UI sub-system interacts with Compose UI components to render AR/VR objects.

##### Architectural Patterns & Principles
- MVVM + Repository: clear separation of UI, state-handling, domain logic, and data sources
- Dependency Injection (Hilt): loosely coupled modules
- Single Activity Compose with navigation between screens
- Offline support: Room local cache + network fetch

##### Essential Details to Capture
- Hilt DI graph connecting network & database to repositories
- Retrofit service endpoint (PokemonService) ↔ REST API
- Room database schema (Entities & DAOs)
- Flow of Pokémon data: remote fetch → map → cache → UI
- XR Compose integration point within UI layer

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "UI Layer"
        XRApp["PokemonXRApplication"]:::ui
        MainAct["MainActivity"]:::ui
        PListScreen["PokemonListScreen"]:::ui
        PDetailsScreen["PokemonDetailsScreen"]:::ui
        GenericViews["Generic Composable Views"]:::ui
        ThemeColor["Color.kt"]:::ui
        ThemeType["Type.kt"]:::ui
        ThemeSetup["Theme.kt"]:::ui
    end

    subgraph "Presentation Layer"
        ListVM["PokemonListViewModel"]:::presentation
        ListState["PokemonListState"]:::presentation
        DetailsVM["PokemonDetailsViewModel"]:::presentation
        DetailsState["PokemonDetailsState"]:::presentation
    end

    subgraph "Domain Layer"
        ListRepoI["PokemonListRepository"]:::domain
        DetailsRepoI["PokemonDetailsRepository"]:::domain
        Service["PokemonService"]:::domain
        NetMgr["MyNetworkManager"]:::domain
        ModelResp["PokemonResponse"]:::domain
        ModelDetails["PokemonDetailsDataModel"]:::domain
        ModelSelected["SelectedPokemonModel"]:::domain
        ModelUI["PokemonDetailsUI"]:::domain
        NetMod["NetworkModules"]:::domain
        PokemonMod["PokemonModule"]:::domain
        ErrMod["HandlingErrorModule"]:::domain
    end

    subgraph "Data Layer"
        ListRepoImpl["PokemonListRepositoryImpl"]:::data
        DetailsRepoImpl["PokemonDetailsRepositoryImpl"]:::data
        Mapper["PokemonDetailsMapper"]:::data
        RetrofitClient["Retrofit Client"]:::data
        RoomDB["MyRoomDatabase"]:::data
        Entities["Entities"]:::data
        DAOs["DAOs"]:::data
        TypeConv["TypeConverter"]:::data
        DBModule["MyRoomDatabaseModule"]:::data
    end

    subgraph "External / Infra"
        XRLib["AndroidX XR Library"]:::external
        RetrofitLib["Retrofit"]:::external
        RoomLib["Room"]:::external
        Coil["Coil"]:::external
        Palette["Palette"]:::external
        Hilt["Hilt"]:::external
        KSP["KSP"]:::external
        R8["R8"]:::external
        REST["REST API"]:::external
    end

    XRApp --> MainAct
    MainAct --> PListScreen
    MainAct --> PDetailsScreen
    PListScreen --> ListVM
    PDetailsScreen --> DetailsVM
    ListVM --> ListState
    DetailsVM --> DetailsState
    ListVM --> ListRepoI
    DetailsVM --> DetailsRepoI
    ListRepoI --> ListRepoImpl
    DetailsRepoI --> DetailsRepoImpl
    ListRepoImpl --> RetrofitClient
    ListRepoImpl --> DAOs
    DetailsRepoImpl --> RetrofitClient
    DetailsRepoImpl --> DAOs
    RetrofitClient --> Service
    Service --> REST
    RetrofitClient --> NetMgr
    DAOs --> RoomDB
    RoomDB --> Entities
    RoomDB --> DAOs
    TypeConv --> RoomDB
    NetMod --> RetrofitClient
    PokemonMod --> ListRepoI
    PokemonMod --> DetailsRepoI
    ErrMod --> ListRepoImpl
    ErrMod --> DetailsRepoImpl
    DBModule --> RoomDB
    DBModule --> DAOs
    PListScreen --> XRLib
    PDetailsScreen --> XRLib
    GenericViews --> XRLib
    Hilt -.-> NetMod
    Hilt -.-> DBModule
    Hilt -.-> PokemonMod
    Hilt -.-> ErrMod
    Hilt -.-> ListRepoImpl
    Hilt -.-> DetailsRepoImpl

    classDef ui fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef presentation fill:#cce5ff,stroke:#333,stroke-width:1px
    classDef domain fill:#d4edda,stroke:#333,stroke-width:1px
    classDef data fill:#ffe5b4,stroke:#333,stroke-width:1px
    classDef external fill:#e2e3e5,stroke:#333,stroke-width:1px

    click XRApp "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/PokemonXRApplication.kt"
    click MainAct "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/presentation/MainActivity.kt"
    click PListScreen "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/presentation/pokemon_list_screen/PokemonListScreen.kt"
    click PDetailsScreen "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/presentation/pokemon_details_screen/PokemonDetailsScreen.kt"
    click GenericViews "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/presentation/generic_compose_views/GenericViews.kt"
    click GenericViews "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/presentation/generic_compose_views/Toolbar.kt"
    click ThemeColor "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/ui/theme/Color.kt"
    click ThemeType "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/ui/theme/Type.kt"
    click ThemeSetup "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/ui/theme/Theme.kt"
    click ListVM "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/presentation/pokemon_list_screen/PokemonListViewModel.kt"
    click ListState "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/presentation/pokemon_list_screen/PokemonListState.kt"
    click DetailsVM "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/presentation/pokemon_details_screen/PokemonDetailsViewModel.kt"
    click DetailsState "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/presentation/pokemon_details_screen/PokemonDetailsState.kt"
    click ListRepoI "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/domain/repositories/PokemonListRepository.kt"
    click DetailsRepoI "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/domain/repositories/PokemonDetailsRepository.kt"
    click Service "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/domain/network/PokemonService.kt"
    click NetMgr "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/domain/network/init_network/MyNetworkManager.kt"
    click ModelResp "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/domain/models/pokemon_response_model/PokemonResponse.kt"
    click ModelDetails "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/domain/models/pokemon_details_data_model/PokemonDetailsDataModel.kt"
    click ModelSelected "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/domain/models/pokemon_details_data_model/SelectedPokemonModel.kt"
    click ModelUI "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/domain/models/models/PokemonDetailsUI.kt"
    click NetMod "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/domain/di/network/NetworkModules.kt"
    click PokemonMod "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/domain/di/network/services/PokemonModule.kt"
    click ErrMod "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/domain/di/handing_error/HandlingErrorModule.kt"
    click ListRepoImpl "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/data/repository_impl/PokemonListRepositoryImpl.kt"
    click DetailsRepoImpl "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/data/repository_impl/PokemonDetailsRepositoryImpl.kt"
    click Mapper "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/data/mappers/PokemonDetailsMapper.kt"
    click RoomDB "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/data/room_database/init_database/MyRoomDatabase.kt"
    click Entities "https://github.com/nicosnicolaou16/pokedex_compose_xr/tree/main/app/src/main/java/com/nicos/pokedex_compose_xr/data/room_database/entities"
    click DAOs "https://github.com/nicosnicolaou16/pokedex_compose_xr/tree/main/app/src/main/java/com/nicos/pokedex_compose_xr/data/room_database/entities/daos"
    click TypeConv "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/data/room_database/type_converters/TypeConverter.kt"
    click DBModule "https://github.com/nicosnicolaou16/pokedex_compose_xr/blob/main/app/src/main/java/com/nicos/pokedex_compose_xr/data/di/database/MyRoomDatabaseModule.kt"
```
