# keiyoushi/extensions-lib architecture

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

- Interactive diagram: https://gitdiagram.com/keiyoushi/extensions-lib
- Repository: https://github.com/keiyoushi/extensions-lib

## Overview

##### Main Components
- Library Module: The project’s core is the “library” folder, and within that, the Android library module. This module is what developers will include as a dependency into Tachiyomi.
- Android Platform Integration: Notice the AndroidManifest.xml and the usage of various Android and androidx components. These elements indicate Android framework integration, especially for UI preferences (see the androidx/preference package).
- Network Layer: There is a dedicated network package managing HTTP requests, JavaScript engine functionality (JavaScriptEngine.kt), and network helpers (NetworkHelper.kt, OkHttpExtensions.kt). It even includes specialized interceptors (RateLimitInterceptor and SpecificHostRateLimitInterceptor) for request management.
- Source Handling: The “source” package (and its subpackages ‘model’ and ‘online’) encapsulates the logic for various data sources—for example, CatalogueSource, ConfigurableSource, and ParsedHttpSource—each of which defines the contract for how Tachiyomi extensions retrieve content.
- Utility Components: A utilities package (e.g., util/JsoupExtensions.kt) that likely assists with parsing HTML and other common tasks encountered in a content aggregation extension library.

- Library Module as the central component from which everything emanates.
- Inside this module, create distinct subcomponents or layers:
- Android Foundation Layer: Represent AndroidManifest.xml, and the android and androidx/preference packages, indicating the integration with Android’s UI/Preference systems.
- Source Abstraction Layer: Show the source package, differentiating between general interfaces (Source.kt, SourceFactory.kt) and the online-specific implementations (ParsedHttpSource.kt). Additionally, indicate the “model” subpackage (containing classes like SManga, SChapter, Page, etc.) as the data structures consumed and produced by these sources.

##### Architectural Patterns and Design Principles
- Modular Design: The clear separation into packages (android, network, source, util) demonstrates a modular approach, making it easier to manage complexity and enforce separation of concerns.

##### Relevant Technologies and Frameworks
- Android SDK: Indicated by the AndroidManifest.xml, Context.java, and androidx preference classes.
- OkHttp (implied by OkHttpExtensions and the nature of network requests).
- Gradle: Shown by build.gradle files and gradle wrapper; this informs you about build and dependency management.
- Tachiyomi: As this is an extensions library for Tachiyomi, ensure to indicate the integration point at which Tachiyomi would use this library (likely through the dependency mechanism defined in the README).

## Diagram (Mermaid)

```mermaid
graph TD
    TachiyomiApp["Tachiyomi App"]:::external
    LibraryModule["Library Module"]:::library
    AndroidIntegration["Android Integration (Manifest & AndroidX)"]:::android
    NetworkModule["Network Module"]:::network
    JS["JavaScriptEngine.kt"]:::network
    NH["NetworkHelper.kt"]:::network
    OKE["OkHttpExtensions.kt"]:::network
    INT["Interceptors"]:::network
    RLI["RateLimitInterceptor.kt"]:::network
    SHRLI["SpecificHostRateLimitInterceptor.kt"]:::network
    SourceModule["Source Module"]:::source
    UtilityFunctions["Utility Functions (JsoupExtensions.kt)"]:::utility

    TachiyomiApp -->|"includes"| LibraryModule
    LibraryModule -->|"contains"| AndroidIntegration
    LibraryModule -->|"contains"| NetworkModule
    LibraryModule -->|"contains"| SourceModule
    LibraryModule -->|"contains"| UtilityFunctions

    NetworkModule -->|"implements"| JS
    JS -->|"calls"| NH
    NH -->|"utilizes"| OKE
    NetworkModule -->|"includes"| INT
    INT -->|"contains"| RLI
    INT -->|"contains"| SHRLI

    SourceModule -->|"depends_on"| NetworkModule
    SourceModule -->|"uses"| UtilityFunctions
    NetworkModule -->|"uses"| UtilityFunctions

    %% Click Events
    click LibraryModule "https://github.com/keiyoushi/extensions-lib/tree/main/library/"
    click AndroidIntegration "https://github.com/keiyoushi/extensions-lib/blob/main/library/src/main/AndroidManifest.xml"
    click NetworkModule "https://github.com/keiyoushi/extensions-lib/tree/main/library/src/main/java/eu/kanade/tachiyomi/network/"
    click JS "https://github.com/keiyoushi/extensions-lib/blob/main/library/src/main/java/eu/kanade/tachiyomi/network/JavaScriptEngine.kt"
    click NH "https://github.com/keiyoushi/extensions-lib/blob/main/library/src/main/java/eu/kanade/tachiyomi/network/NetworkHelper.kt"
    click OKE "https://github.com/keiyoushi/extensions-lib/blob/main/library/src/main/java/eu/kanade/tachiyomi/network/OkHttpExtensions.kt"
    click INT "https://github.com/keiyoushi/extensions-lib/tree/main/library/src/main/java/eu/kanade/tachiyomi/network/interceptor"
    click SourceModule "https://github.com/keiyoushi/extensions-lib/tree/main/library/src/main/java/eu/kanade/tachiyomi/source/"
    click UtilityFunctions "https://github.com/keiyoushi/extensions-lib/blob/main/library/src/main/java/eu/kanade/tachiyomi/util/JsoupExtensions.kt"

    %% Styles
    classDef external fill:#FFC0CB,stroke:#000,stroke-width:2px
    classDef library fill:#D3D3D3,stroke:#000,stroke-width:2px
    classDef android fill:#ADD8E6,stroke:#000,stroke-width:2px
    classDef network fill:#90EE90,stroke:#000,stroke-width:2px
    classDef source fill:#FFFFE0,stroke:#000,stroke-width:2px
    classDef utility fill:#FFDAB9,stroke:#000,stroke-width:2px
```
