# kingoxi/kotatsu-parsers architecture

> Architecture diagram of the GitHub repository kingoxi/kotatsu-parsers, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-23). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kingoxi/kotatsu-parsers
- Repository: https://github.com/kingoxi/kotatsu-parsers

## Overview

Kotatsu parsers is a JVM/Android library that adapts many manga websites to a common API. A consumer asks MangaLoaderContext for a parser by source; generated source metadata and a factory support that lookup, and a source adapter fetches and parses catalog, manga, chapter, and page data into shared models. The library also exposes search/filter capabilities and configurable network/authentication facilities. Evidence is limited to the README and sampled/indexed files, so unsampled site-specific calls and subsystem wiring are not inferred.

Main entry points: [`src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/MadaraParser.kt`](https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/MadaraParser.kt) (Madara adapter), [`src/main/kotlin/org/koitharu/kotatsu/parsers/MangaLoaderContext.kt`](https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/MangaLoaderContext.kt) (Loader context), [`kotatsu-parsers-ksp/src/main/kotlin/org/koitharu/kotatsu/parsers/ksp/ParserProcessor.kt`](https://github.com/kingoxi/kotatsu-parsers/blob/master/kotatsu-parsers-ksp/src/main/kotlin/org/koitharu/kotatsu/parsers/ksp/ParserProcessor.kt) (Parser codegen), [`src/main/kotlin/org/koitharu/kotatsu/parsers/model/search/MangaSearchQuery.kt`](https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/model/search/MangaSearchQuery.kt) (Search queries)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Parser entry"]
  node_context["Loader context"]
  node_source_annotation["Source annotation"]
  node_processor["Parser codegen<br/>[ParserProcessor.kt]"]
  node_parser_contract["Parser contract<br/>[MangaParser.kt]"]
  node_parser_core["Parser base classes"]
  node_wrapper["Parser wrapper"]
end

subgraph group_adapters["Source adapters"]
  node_madara["Madara adapter<br/>[MadaraParser.kt]"]
  node_site_adapters["Website adapters"]
end

subgraph group_domain["Manga domain"]
  node_filter["Browse filters<br/>[MangaListFilter.kt]"]
  node_filter_caps["Filter capabilities"]
  node_search_query["Search queries"]
  node_search_conversion["Query conversion"]
  node_manga_model["Manga records<br/>[Manga.kt]"]
  node_chapter_model["Chapter records<br/>[MangaChapter.kt]"]
  node_page_model["Page records<br/>[MangaPage.kt]"]
end

subgraph group_transport["Network services"]
  node_web_client["Web client<br/>[WebClient.kt]"]
  node_okhttp["OkHttp client<br/>[OkHttpWebClient.kt]"]
end

node_consumer(("Library consumer"))
node_source_web(("Manga websites"))

node_consumer -->|"requests parser"| node_context
node_context -.->|"uses generated factory"| node_processor
node_processor -->|"scans annotations"| node_source_annotation
node_processor -->|"wraps parser"| node_wrapper
node_processor -.->|"registers parsers"| node_site_adapters
node_context -->|"returns parser"| node_parser_contract
node_madara -->|"fetches pages"| node_source_web
node_madara -->|"applies filters"| node_filter
node_search_conversion -->|"converts queries"| node_search_query
node_search_query -->|"expresses criteria"| node_filter
node_search_query -->|"checks support"| node_filter_caps
node_madara -.->|"parses manga"| node_manga_model
node_parser_core -.->|"implements"| node_parser_contract
node_madara -.->|"uses web client"| node_web_client
node_okhttp -->|"implements"| node_web_client
node_context -->|"provides HTTP client"| node_okhttp

click node_context "https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/MangaLoaderContext.kt"
click node_source_annotation "https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/MangaSourceParser.kt"
click node_processor "https://github.com/kingoxi/kotatsu-parsers/blob/master/kotatsu-parsers-ksp/src/main/kotlin/org/koitharu/kotatsu/parsers/ksp/ParserProcessor.kt"
click node_parser_contract "https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/MangaParser.kt"
click node_parser_core "https://github.com/kingoxi/kotatsu-parsers/tree/master/src/main/kotlin/org/koitharu/kotatsu/parsers/core"
click node_wrapper "https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/core/MangaParserWrapper.kt"
click node_madara "https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/MadaraParser.kt"
click node_site_adapters "https://github.com/kingoxi/kotatsu-parsers/tree/master/src/main/kotlin/org/koitharu/kotatsu/parsers/site"
click node_filter "https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/model/MangaListFilter.kt"
click node_filter_caps "https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/model/MangaListFilterCapabilities.kt"
click node_search_query "https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/model/search/MangaSearchQuery.kt"
click node_search_conversion "https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/util/SearchQueryConverter.kt"
click node_manga_model "https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/model/Manga.kt"
click node_chapter_model "https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/model/MangaChapter.kt"
click node_page_model "https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/model/MangaPage.kt"
click node_web_client "https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/network/WebClient.kt"
click node_okhttp "https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/network/OkHttpWebClient.kt"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_context,node_source_annotation,node_processor,node_parser_contract,node_parser_core,node_wrapper toneBlue
class node_madara,node_site_adapters toneAmber
class node_filter,node_filter_caps,node_search_query,node_search_conversion,node_manga_model,node_chapter_model,node_page_model toneMint
class node_web_client,node_okhttp toneRose
class node_consumer,node_source_web toneIndigo
```

## Components

### Parser entry

- [Loader context](https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/MangaLoaderContext.kt): `src/main/kotlin/org/koitharu/kotatsu/parsers/MangaLoaderContext.kt`
- [Source annotation](https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/MangaSourceParser.kt): `src/main/kotlin/org/koitharu/kotatsu/parsers/MangaSourceParser.kt`
- [Parser codegen](https://github.com/kingoxi/kotatsu-parsers/blob/master/kotatsu-parsers-ksp/src/main/kotlin/org/koitharu/kotatsu/parsers/ksp/ParserProcessor.kt): `kotatsu-parsers-ksp/src/main/kotlin/org/koitharu/kotatsu/parsers/ksp/ParserProcessor.kt`
- [Parser contract](https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/MangaParser.kt): `src/main/kotlin/org/koitharu/kotatsu/parsers/MangaParser.kt`
- [Parser base classes](https://github.com/kingoxi/kotatsu-parsers/tree/master/src/main/kotlin/org/koitharu/kotatsu/parsers/core): `src/main/kotlin/org/koitharu/kotatsu/parsers/core`
- [Parser wrapper](https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/core/MangaParserWrapper.kt): `src/main/kotlin/org/koitharu/kotatsu/parsers/core/MangaParserWrapper.kt`

### Source adapters

- [Madara adapter](https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/MadaraParser.kt): `src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/MadaraParser.kt`
- [Website adapters](https://github.com/kingoxi/kotatsu-parsers/tree/master/src/main/kotlin/org/koitharu/kotatsu/parsers/site): `src/main/kotlin/org/koitharu/kotatsu/parsers/site`

### Manga domain

- [Browse filters](https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/model/MangaListFilter.kt): `src/main/kotlin/org/koitharu/kotatsu/parsers/model/MangaListFilter.kt`
- [Filter capabilities](https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/model/MangaListFilterCapabilities.kt): `src/main/kotlin/org/koitharu/kotatsu/parsers/model/MangaListFilterCapabilities.kt`
- [Search queries](https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/model/search/MangaSearchQuery.kt): `src/main/kotlin/org/koitharu/kotatsu/parsers/model/search/MangaSearchQuery.kt`
- [Query conversion](https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/util/SearchQueryConverter.kt): `src/main/kotlin/org/koitharu/kotatsu/parsers/util/SearchQueryConverter.kt`
- [Manga records](https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/model/Manga.kt): `src/main/kotlin/org/koitharu/kotatsu/parsers/model/Manga.kt`
- [Chapter records](https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/model/MangaChapter.kt): `src/main/kotlin/org/koitharu/kotatsu/parsers/model/MangaChapter.kt`
- [Page records](https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/model/MangaPage.kt): `src/main/kotlin/org/koitharu/kotatsu/parsers/model/MangaPage.kt`

### Network services

- [Web client](https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/network/WebClient.kt): `src/main/kotlin/org/koitharu/kotatsu/parsers/network/WebClient.kt`
- [OkHttp client](https://github.com/kingoxi/kotatsu-parsers/blob/master/src/main/kotlin/org/koitharu/kotatsu/parsers/network/OkHttpWebClient.kt): `src/main/kotlin/org/koitharu/kotatsu/parsers/network/OkHttpWebClient.kt`

### Other components

- **Library consumer**
- **Manga websites**

## Connections

- Library consumer → Loader context: requests parser (evidence: `README.md`)
- Loader context → Parser codegen: uses generated factory (evidence: `kotatsu-parsers-ksp/src/main/kotlin/org/koitharu/kotatsu/parsers/ksp/ParserProcessor.kt`)
- Parser codegen → Source annotation: scans annotations (evidence: `kotatsu-parsers-ksp/src/main/kotlin/org/koitharu/kotatsu/parsers/ksp/ParserProcessor.kt`)
- Parser codegen → Parser wrapper: wraps parser (evidence: `kotatsu-parsers-ksp/src/main/kotlin/org/koitharu/kotatsu/parsers/ksp/ParserProcessor.kt`)
- Parser codegen → Website adapters: registers parsers
- Loader context → Parser contract: returns parser (evidence: `src/main/kotlin/org/koitharu/kotatsu/parsers/MangaLoaderContext.kt`)
- Madara adapter → Manga websites: fetches pages (evidence: `src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/MadaraParser.kt`)
- Madara adapter → Browse filters: applies filters (evidence: `src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/MadaraParser.kt`)
- Query conversion → Search queries: converts queries (evidence: `src/main/kotlin/org/koitharu/kotatsu/parsers/util/SearchQueryConverter.kt`)
- Search queries → Browse filters: expresses criteria (evidence: `src/main/kotlin/org/koitharu/kotatsu/parsers/model/search/MangaSearchQuery.kt`)
- Search queries → Filter capabilities: checks support (evidence: `src/main/kotlin/org/koitharu/kotatsu/parsers/model/search/MangaSearchQueryCapabilities.kt`)
- Madara adapter → Manga records: parses manga (evidence: `src/main/kotlin/org/koitharu/kotatsu/parsers/site/madara/MadaraParser.kt`)
- Parser base classes → Parser contract: implements
- Madara adapter → Web client: uses web client
- OkHttp client → Web client: implements (evidence: `src/main/kotlin/org/koitharu/kotatsu/parsers/network/OkHttpWebClient.kt`)
- Loader context → OkHttp client: provides HTTP client (evidence: `src/main/kotlin/org/koitharu/kotatsu/parsers/MangaLoaderContext.kt`)
