# mohamedcs1/poke architecture

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

- Interactive diagram: https://gitdiagram.com/mohamedcs1/poke
- Repository: https://github.com/mohamedcs1/poke

## Overview

##### Project type and purpose
- This is an Android mobile application (“Poke”) written in Kotlin.
- Its primary function is to fetch a list of Pokémon from a remote API, display them in a RecyclerView, and allow the user to save favorites locally.

##### File structure
Top-level “app” module
- build.gradle / AndroidManifest.xml / proguard-rules: standard Android config
- src/main/java/com/example: contains the core code, organized into:
– poke: Application class, Activities (MainActivity, FavActivity)
– viewmodels: MVVM ViewModels (PokemonsViewModel)
– repository: Repository layer that exposes data to ViewModels
– network: Retrofit interface (PokemonApiService)
– database: Room DAO and Database classes (PokemonDao, PokemonDataBase)
– di: Dependency-injection modules (RetrofitModule, DataBaseModule)
– pojo: Data models (Pokemon, PokemonResponse)
– Adapters: RecyclerView Adapters for list and favorites
– Tools: Converter utilities for Room type conversions
- src/androidTest & src/test: Instrumentation & unit tests

##### README
- Minimal content (“# Poke”), but combined with code it confirms it’s a client-only MVVM Android app using Retrofit + Room + DI.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph "Presentation Layer"
        MA["MainActivity"]:::ui
        FA["FavActivity"]:::ui
        AP["AdapterPokemons"]:::ui
        AF["AdapterFav"]:::ui
    end

    subgraph "ViewModel & Domain Layer"
        VM["PokemonsViewModel"]:::domain
        Repo["Repository"]:::domain
    end

    subgraph "Data Sources"
        Api["PokemonApiService"]:::data
        DAO["PokemonDao"]:::data
        DB["PokemonDataBase"]:::data
        Models["Pokemon\nPokemonResponse"]:::data
        Conv["Converters"]:::data
    end

    subgraph "DI Modules"
        RM["RetrofitModule"]:::di
        DM["DataBaseModule"]:::di
        BA["BaseApplication"]:::di
    end

    Ext["Pokémon REST API"]:::external

    %% Relationships
    BA -->|"initializes DI"| RM
    BA -->|"initializes DI"| DM

    RM -->|"provides Retrofit"| Api
    DM -->|"provides DB & DAO"| DB
    DM -->|"provides DB & DAO"| DAO

    MA -->|"binds to"| VM
    FA -->|"binds to"| VM
    MA -->|"uses Adapter"| AP
    FA -->|"uses Adapter"| AF

    VM -->|"getPokemons(), saveFavorite()"| Repo
    Repo -->|"fetchList()"| Api
    Repo -->|"save/load()"| DAO

    Api -->|"HTTP calls"| Ext
    DAO -->|"persists data"| DB

    %% Click Events
    click MA "https://github.com/mohamedcs1/poke/blob/main/app/src/main/java/com/example/poke/MainActivity.kt"
    click FA "https://github.com/mohamedcs1/poke/blob/main/app/src/main/java/com/example/poke/FavActivity.kt"
    click AP "https://github.com/mohamedcs1/poke/blob/main/app/src/main/java/com/example/Adapters/AdapterPokemons.kt"
    click AF "https://github.com/mohamedcs1/poke/blob/main/app/src/main/java/com/example/Adapters/AdapterFav.kt"
    click VM "https://github.com/mohamedcs1/poke/blob/main/app/src/main/java/com/example/viewmodels/PokemonsViewModel.kt"
    click Repo "https://github.com/mohamedcs1/poke/blob/main/app/src/main/java/com/example/repository/Repository.kt"
    click Api "https://github.com/mohamedcs1/poke/blob/main/app/src/main/java/com/example/network/PokemonApiService.kt"
    click DB "https://github.com/mohamedcs1/poke/blob/main/app/src/main/java/com/example/database/PokemonDataBase.kt"
    click DAO "https://github.com/mohamedcs1/poke/blob/main/app/src/main/java/com/example/database/PokemonDao.kt"
    click RM "https://github.com/mohamedcs1/poke/blob/main/app/src/main/java/com/example/di/RetrofitModule.kt"
    click DM "https://github.com/mohamedcs1/poke/blob/main/app/src/main/java/com/example/di/DataBaseModule.kt"
    click BA "https://github.com/mohamedcs1/poke/blob/main/app/src/main/java/com/example/poke/BaseApplication.kt"
    click Models "https://github.com/mohamedcs1/poke/blob/main/app/src/main/java/com/example/pojo/Pokemon.kt"
    click Models "https://github.com/mohamedcs1/poke/blob/main/app/src/main/java/com/example/pojo/PokemonResponse.kt"
    click Conv "https://github.com/mohamedcs1/poke/blob/main/app/src/main/java/com/example/Tools/Converters.kt"

    %% Styles
    classDef ui fill:#BBDEFB,stroke:#1E88E5,color:#0D47A1
    classDef domain fill:#C8E6C9,stroke:#43A047,color:#1B5E20
    classDef data fill:#FFE0B2,stroke:#FB8C00,color:#E65100
    classDef di fill:#E0E0E0,stroke:#9E9E9E,color:#424242
    classDef external fill:#E1BEE7,stroke:#8E24AA,color:#4A148C
```
