# compileconnected/tachiyomi architecture

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

- Interactive diagram: https://gitdiagram.com/compileconnected/tachiyomi
- Repository: https://github.com/compileconnected/tachiyomi

## Overview

##### Main Components

a. Frontend Layer (Presentation)
- Compose UI components (under presentation-core/)
- Screens and navigation (under app/src/main/java/eu/kanade/presentation/)
- Widgets (under presentation-widget/)
- Theme and styling components

b. Domain Layer
- Use cases/interactors (under domain/src/main/java/tachiyomi/domain/)
- Models and entities
- Repository interfaces
- Business logic

c. Data Layer
- Repositories implementation (under data/src/main/java/tachiyomi/data/)
- Local storage (SQLite via SQLDelight)
- Network clients
- Cache management

d. Source Management
- Source API (under source-api/)
- Local source handling (source-local/)
- Extension system (under app/src/main/java/eu/kanade/tachiyomi/extension/)

##### Core Features to Highlight

a. Manga Management
- Library organization
- Categories
- Download management
- Reading history

b. Reader Component
- Multiple viewer types (pager, webtoon)
- Chapter navigation
- Reading settings

c. Tracking System
- Multiple tracker support (MAL, AniList, etc.)
- Sync functionality
- Progress tracking

##### Data Flow Representation

a. Main Data Flows
- Manga discovery → Library addition → Reading
- Chapter updates → Download → Local storage
- Reading progress → Tracker sync

b. Background Operations
- Library updates
- Download queue
- Backup system

##### External Integrations

a. Source Extensions
- Extension installation system
- Source catalogues
- Update mechanism

b. Tracking Services
- Authentication
- Data synchronization
- API integration

##### Technical Components

a. Storage
- Database (SQLDelight)
- File system for downloads
- Preferences

b. Network
- HTTP client
- Image loading
- API clients

**[User Interface Layer]**
**↓↑**
**[Presentation Layer (ViewModels)]**
**↓↑**
**[Domain Layer (Use Cases)]**
**↓↑**
**[Data Layer (Repositories)]**
**↓↑**
**[Local Storage] ←→ [Network Layer] ←→ [External Services]**

Key Considerations:

##### Connection Types
- Double lines: Data flow

##### Legends for
- Component types
- Data flow directions
- State management
- Background processes

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and classes
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef domain fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#e74c3c,stroke:#c0392b,color:white
    classDef service fill:#9b59b6,stroke:#8e44ad,color:white

    %% User Interface Layer
    subgraph UI
        UIComponents["UI Components"]:::ui
        Screens["Screens"]:::ui
        Widgets["Widgets"]:::ui
        Theme["Theme"]:::ui
    end

    %% Presentation Layer
    subgraph Presentation
        ViewModels["ViewModels"]:::ui
    end

    %% Domain Layer
    subgraph Domain
        UseCases["Use Cases"]:::domain
        Models["Models"]:::domain
        RepoInterfaces["Repository Interfaces"]:::domain
        BusinessLogic["Business Logic"]:::domain
    end

    %% Data Layer
    subgraph Data
        RepoImpl["Repository Implementations"]:::data
        LocalStorage["Local Storage (SQLite)"]:::data
        NetworkClient["Network Client"]:::data
        CacheManagement["Cache Management"]:::data
    end

    %% Source Management
    subgraph Sources
        SourceAPI["Source API"]:::external
        LocalSource["Local Source"]:::external
        ExtensionSystem["Extension System"]:::external
    end

    %% Core Features
    subgraph Features
        Reader["Reader Component"]:::service
        Library["Library Management"]:::service
        Downloads["Download System"]:::service
        Tracking["Tracking System"]:::service
    end

    %% External Services
    ExternalServices["External Services\n(MAL, AniList)"]:::external

    %% Relationships
    UIComponents --> ViewModels
    Screens --> ViewModels
    Widgets --> ViewModels
    Theme --> UIComponents

    ViewModels --> UseCases
    UseCases --> Models
    UseCases --> RepoInterfaces
    UseCases --> BusinessLogic

    RepoInterfaces --> RepoImpl
    RepoImpl --> LocalStorage
    RepoImpl --> NetworkClient
    RepoImpl --> CacheManagement

    NetworkClient --> SourceAPI
    SourceAPI --> LocalSource
    SourceAPI --> ExtensionSystem
    ExtensionSystem --> ExternalServices

    Features --> UseCases
    Tracking --> ExternalServices

    %% Click events
    click UIComponents "https://github.com/CompileConnected/tachiyomi/tree/master/presentation-core/src/main/java/tachiyomi/presentation/core/components"
    click Screens "https://github.com/CompileConnected/tachiyomi/tree/master/app/src/main/java/eu/kanade/presentation"
    click Widgets "https://github.com/CompileConnected/tachiyomi/tree/master/presentation-widget/src/main/java/tachiyomi/presentation/widget"
    click Theme "https://github.com/CompileConnected/tachiyomi/tree/master/presentation-core/src/main/java/tachiyomi/presentation/core/theme"
    click UseCases "https://github.com/CompileConnected/tachiyomi/tree/master/domain/src/main/java/tachiyomi/domain/*/interactor"
    click Models "https://github.com/CompileConnected/tachiyomi/tree/master/domain/src/main/java/tachiyomi/domain/*/model"
    click RepoInterfaces "https://github.com/CompileConnected/tachiyomi/tree/master/domain/src/main/java/tachiyomi/domain/*/repository"
    click BusinessLogic "https://github.com/CompileConnected/tachiyomi/tree/master/domain/src/main/java/tachiyomi/domain/*/service"
    click RepoImpl "https://github.com/CompileConnected/tachiyomi/tree/master/data/src/main/java/tachiyomi/data"
    click LocalStorage "https://github.com/CompileConnected/tachiyomi/tree/master/data/src/main/sqldelight"
    click NetworkClient "https://github.com/CompileConnected/tachiyomi/tree/master/core/src/main/java/eu/kanade/tachiyomi/network"
    click CacheManagement "https://github.com/CompileConnected/tachiyomi/tree/master/app/src/main/java/eu/kanade/tachiyomi/data/cache"
    click SourceAPI "https://github.com/CompileConnected/tachiyomi/tree/master/source-api/src/commonMain/kotlin/eu/kanade/tachiyomi/source"
    click LocalSource "https://github.com/CompileConnected/tachiyomi/tree/master/source-local/src/commonMain/kotlin/tachiyomi/source/local"
    click ExtensionSystem "https://github.com/CompileConnected/tachiyomi/tree/master/app/src/main/java/eu/kanade/tachiyomi/extension"
    click Reader "https://github.com/CompileConnected/tachiyomi/tree/master/app/src/main/java/eu/kanade/tachiyomi/ui/reader"
    click Library "https://github.com/CompileConnected/tachiyomi/tree/master/app/src/main/java/eu/kanade/tachiyomi/ui/library"
    click Downloads "https://github.com/CompileConnected/tachiyomi/tree/master/app/src/main/java/eu/kanade/tachiyomi/data/download"
    click Tracking "https://github.com/CompileConnected/tachiyomi/tree/master/app/src/main/java/eu/kanade/tachiyomi/data/track"
```
