# decoutkhanqindev/dexreader architecture

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

- Interactive diagram: https://gitdiagram.com/decoutkhanqindev/dexreader
- Repository: https://github.com/decoutkhanqindev/dexreader

## Overview

##### Project type and purpose
- Dex Reader is an Android mobile application (client-side) implemented in Kotlin with Jetpack Compose.
- It follows Clean Architecture with MVVM, fetching manga data from the MangaDex API and synchronizing user data via Firebase Auth & Firestore.
- Purpose: present manga lists, details, reader, search, categories, favorites, history, profile, settings.

##### File structure
- Top-level module: app/ (Gradle, AndroidManifest, resources, Kotlin sources).
- Packages under com.decoutkhanqindev.dexreader:
- data/ (local database & prefs, network APIs & DTOs, repository implementations, mappers)
- domain/ (models, repository interfaces, use-cases)
- presentation/ (Composable screens, view models, navigation, theme)
- di/ (Hilt modules: LocalDataModule, NetworkDataModule, RepositoryModule)
- utils/ (shared helpers)
- Build scripts: Gradle Kotlin DSL, google-services.json, proguard, wrapper.
- Tests: instrumented and unit tests.

##### README for additional insights
- Architecture: MVVM + Clean Architecture.
- Tech stack: Kotlin, Compose, Hilt, Room, DataStore, Retrofit + OkHttp + Moshi, Firebase Auth, Firestore, Coil, Coroutines/Flow.
- Features: caching, pre-fetching, theme sync.

2. In Presentation layer, list major screens (Home, Reader, Search, Categories, Details, Auth, Profile, Settings) plus ViewModels.
– Local: Room DAOs & DataStore
– Network: Retrofit services (MangaDexApiService), FirebaseAuthSource, FirestoreSource
6. DI container (Hilt) on the side or as an overarching module injecting each layer’s dependencies.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Presentation Layer
    subgraph "Presentation Layer"
        UI["Screens & ViewModels"]:::presentation
        Nav["Navigation"]:::presentation
        Theme["Theme & UI Setup"]:::presentation
        App["Application Entry Point"]:::presentation
    end

    %% Domain Layer
    subgraph "Domain Layer"
        Models["Domain Models"]:::domain
        Repos["Repository Interfaces"]:::domain
        UseCases["Use Cases"]:::domain
    end

    %% Data Layer
    subgraph "Data Layer"
        RepoImpl["Repository Implementations"]:::data
        subgraph "Local Data Sources"
            DB[("Room DB")]:::cylinder
            DAO["DAOs & Entities"]:::data
            DataStore[("DataStore")]:::cylinder
        end
        subgraph "Network Data Sources"
            ApiServ["MangaDex API Service"]:::data
            DTO["DTOs"]:::data
            AuthSrc["FirebaseAuth Source"]:::data
            FirestoreSrc["Firestore Source"]:::data
        end
        Mappers["Data Mappers"]:::data
        DataUtils["Data Utilities"]:::data
    end

    %% External Services
    CloudMangaDex(("MangaDex API")):::cloud
    CloudAuth(("Firebase Auth")):::cloud
    CloudFS(("Firebase Firestore")):::cloud

    %% DI Container
    DI["Hilt DI Modules"]:::di

    %% Data Flows
    UI -->|"invokes"| UseCases
    UseCases -->|"calls"| Repos
    Repos -->|"binds"| RepoImpl
    RepoImpl -->|"reads cache"| DB
    RepoImpl -->|"reads DAO"| DAO
    RepoImpl -->|"reads prefs"| DataStore
    RepoImpl -->|"HTTP GET"| ApiServ
    ApiServ -->|"maps DTO"| DTO
    RepoImpl -->|"auth operations"| AuthSrc
    RepoImpl -->|"firestore ops"| FirestoreSrc

    ApiServ -->|"requests"| CloudMangaDex
    AuthSrc -->|"auth call"| CloudAuth
    FirestoreSrc -->|"db call"| CloudFS

    %% Dependency Injection
    DI -.-> UI
    DI -.-> Nav
    DI -.-> Theme
    DI -.-> App
    DI -.-> UseCases
    DI -.-> Repos
    DI -.-> RepoImpl
    DI -.-> DB
    DI -.-> DataStore
    DI -.-> ApiServ
    DI -.-> AuthSrc
    DI -.-> FirestoreSrc

    %% Click Events
    click UI "https://github.com/decoutkhanqindev/dexreader/tree/main/app/src/main/java/com/decoutkhanqindev/dexreader/presentation"
    click Nav "https://github.com/decoutkhanqindev/dexreader/tree/main/app/src/main/java/com/decoutkhanqindev/dexreader/presentation/navigation"
    click UI "https://github.com/decoutkhanqindev/dexreader/tree/main/app/src/main/java/com/decoutkhanqindev/dexreader/presentation/screens"
    click Theme "https://github.com/decoutkhanqindev/dexreader/tree/main/app/src/main/java/com/decoutkhanqindev/dexreader/presentation/theme"
    click App "https://github.com/decoutkhanqindev/dexreader/blob/main/app/src/main/java/com/decoutkhanqindev/dexreader/DexReaderApplication.kt"
    click Models "https://github.com/decoutkhanqindev/dexreader/tree/main/app/src/main/java/com/decoutkhanqindev/dexreader/domain/model"
    click Repos "https://github.com/decoutkhanqindev/dexreader/tree/main/app/src/main/java/com/decoutkhanqindev/dexreader/domain/repository"
    click UseCases "https://github.com/decoutkhanqindev/dexreader/tree/main/app/src/main/java/com/decoutkhanqindev/dexreader/domain/usecase"
    click RepoImpl "https://github.com/decoutkhanqindev/dexreader/tree/main/app/src/main/java/com/decoutkhanqindev/dexreader/data"
    click DB "https://github.com/decoutkhanqindev/dexreader/blob/main/app/src/main/java/com/decoutkhanqindev/dexreader/data/local/database/ChapterCacheDatabase.kt"
    click DAO "https://github.com/decoutkhanqindev/dexreader/blob/main/app/src/main/java/com/decoutkhanqindev/dexreader/data/local/database/dao/ChapterCacheDao.kt"
    click DAO "https://github.com/decoutkhanqindev/dexreader/blob/main/app/src/main/java/com/decoutkhanqindev/dexreader/data/local/database/entity/ChapterCacheEntity.kt"
    click DataStore "https://github.com/decoutkhanqindev/dexreader/blob/main/app/src/main/java/com/decoutkhanqindev/dexreader/data/local/prefs/ThemePrefsManager.kt"
    click ApiServ "https://github.com/decoutkhanqindev/dexreader/blob/main/app/src/main/java/com/decoutkhanqindev/dexreader/data/network/mangadex_api/MangaDexApiService.kt"
    click DTO "https://github.com/decoutkhanqindev/dexreader/tree/main/app/src/main/java/com/decoutkhanqindev/dexreader/data/network/mangadex_api/dto"
    click AuthSrc "https://github.com/decoutkhanqindev/dexreader/blob/main/app/src/main/java/com/decoutkhanqindev/dexreader/data/network/firebase/auth/FirebaseAuthSource.kt"
    click AuthSrc "https://github.com/decoutkhanqindev/dexreader/blob/main/app/src/main/java/com/decoutkhanqindev/dexreader/data/network/firebase/auth/FirebaseAuthSourceImpl.kt"
    click FirestoreSrc "https://github.com/decoutkhanqindev/dexreader/blob/main/app/src/main/java/com/decoutkhanqindev/dexreader/data/network/firebase/firestore/FirebaseFirestoreSource.kt"
    click FirestoreSrc "https://github.com/decoutkhanqindev/dexreader/blob/main/app/src/main/java/com/decoutkhanqindev/dexreader/data/network/firebase/firestore/FirebaseFirestoreSourceImpl.kt"
    click Mappers "https://github.com/decoutkhanqindev/dexreader/tree/main/app/src/main/java/com/decoutkhanqindev/dexreader/data/mapper"
    click RepoImpl "https://github.com/decoutkhanqindev/dexreader/tree/main/app/src/main/java/com/decoutkhanqindev/dexreader/data/repository"
    click DataUtils "https://github.com/decoutkhanqindev/dexreader/tree/main/app/src/main/java/com/decoutkhanqindev/dexreader/data/utils"
    click DI "https://github.com/decoutkhanqindev/dexreader/tree/main/app/src/main/java/com/decoutkhanqindev/dexreader/di"

    %% Styles
    classDef presentation fill:#bbdefb,stroke:#1e88e5,color:#0d47a1
    classDef domain fill:#c8e6c9,stroke:#43a047,color:#1b5e20
    classDef data fill:#ffe0b2,stroke:#fb8c00,color:#e65100
    classDef cylinder fill:#ffecb3,stroke:#ffb300,color:#e65100
    classDef cloud fill:#e1f5fe,stroke:#0288d1,color:#01579b,stroke-dasharray: 5 5
    classDef di fill:#f3e5f5,stroke:#8e24aa,color:#4a148c,stroke-dasharray: 5 5
```
