# moggle-khraum/noveldr architecture

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

- Interactive diagram: https://gitdiagram.com/moggle-khraum/noveldr
- Repository: https://github.com/moggle-khraum/noveldr

## Overview

NovelDR is an Android webnovel downloader and offline reader. Its principal workflow is to find a novel, retrieve its metadata and chapters from a supported source, save it in the library, and read it offline. The graph also preserves documented reader capabilities and the companion API server. Source excerpts establish scraper dispatch and some internal calls; several app screens and persistence links are represented from the README and tree, so their individual wiring is not asserted.

Main entry points: [`artifacts/novel-reader/hooks/useApi.ts`](https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/hooks/useApi.ts) (Scraper Dispatch), [`artifacts/novel-reader/app/reader/[id].tsx`](https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/app/reader/%5Bid%5D.tsx) (Chapter Reader), [`artifacts/novel-reader/app/(tabs)/index.tsx`](https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/app/(tabs)/index.tsx) (Reader App), [`artifacts/novel-reader/app/(tabs)/add.tsx`](https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/app/(tabs)/add.tsx) (Add Novels)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Novel Reader App"]
  node_reader["Reader App<br/>[index.tsx]"]
  node_library[("Library<br/>[LibraryContext.tsx]")]
  node_novel_detail["Novel Index<br/>[&#91;id&#93;.tsx]"]
  node_download_screen["Add Novels<br/>[add.tsx]"]
  node_updates["Updates<br/>[updates.tsx]"]
  node_settings["Settings<br/>[settings.tsx]"]
end

subgraph group_scraping["Novel Acquisition"]
  node_api_dispatch["Scraper Dispatch<br/>[useApi.ts]"]
  node_direct_scraper["Direct Scraper"]
  node_scraper_registry["Source Registry<br/>[registry.ts]"]
  node_source_adapters["Source Adapters"]
  node_webview_bridge["WebView Bridge<br/>[webviewBridge.tsx]"]
end

subgraph group_reading["Reading Features"]
  node_reader_screen["Chapter Reader<br/>[&#91;id&#93;.tsx]"]
  node_chapter_state["Chapter Persistence"]
  node_dictionary["Dictionary Lookup<br/>[useDictionary.ts]"]
  node_glossary[("Personal Glossary<br/>[useGlossary.ts]")]
  node_tts["Text To Speech<br/>[useTTS.ts]"]
end

subgraph group_backend["API Server"]
  node_api_app["API Application<br/>[app.ts]"]
  node_novel_route["Novel Scraping Route<br/>[novel.ts]"]
  node_health_route["Health Route<br/>[health.ts]"]
end

node_external_sources(("Novel Websites"))

node_reader -.->|"opens download"| node_download_screen
node_download_screen -.->|"requests novel"| node_api_dispatch
node_api_dispatch -->|"checks source"| node_scraper_registry
node_api_dispatch -->|"falls back"| node_direct_scraper
node_api_dispatch -->|"checks site"| node_webview_bridge
node_scraper_registry -->|"dispatches to"| node_source_adapters
node_direct_scraper -.->|"fetches pages"| node_external_sources
node_source_adapters -.->|"scrapes pages"| node_external_sources
node_webview_bridge -.->|"loads pages"| node_external_sources
node_download_screen -.->|"adds novels"| node_library
node_library -.->|"shows index"| node_novel_detail
node_novel_detail -.->|"opens chapters"| node_reader_screen
node_reader_screen -.->|"tracks progress"| node_chapter_state
node_reader_screen -.->|"looks up words"| node_dictionary
node_dictionary -->|"uses glossary"| node_glossary
node_reader_screen -.->|"reads aloud"| node_tts
node_api_app -->|"mounts routes"| node_novel_route
node_api_app -.->|"mounts routes"| node_health_route
node_novel_route -.->|"fetches chapters"| node_external_sources
node_reader -.->|"opens updates"| node_updates
node_reader -.->|"opens settings"| node_settings

click node_reader "https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/app/(tabs)/index.tsx"
click node_library "https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/context/LibraryContext.tsx"
click node_novel_detail "https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/app/novel/%5Bid%5D.tsx"
click node_download_screen "https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/app/(tabs)/add.tsx"
click node_updates "https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/app/(tabs)/updates.tsx"
click node_settings "https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/app/(tabs)/settings.tsx"
click node_api_dispatch "https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/hooks/useApi.ts"
click node_direct_scraper "https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/hooks/useDirectScraper.ts"
click node_scraper_registry "https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/hooks/scrapers/registry.ts"
click node_source_adapters "https://github.com/moggle-khraum/noveldr/tree/dev5.5/artifacts/novel-reader/hooks/scrapers/sources"
click node_webview_bridge "https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/hooks/scrapers/shared/webviewBridge.tsx"
click node_reader_screen "https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/app/reader/%5Bid%5D.tsx"
click node_chapter_state "https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/hooks/reader/useChapterPersistence.ts"
click node_dictionary "https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/hooks/reader/useDictionary.ts"
click node_glossary "https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/hooks/reader/useGlossary.ts"
click node_tts "https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/hooks/reader/useTTS.ts"
click node_api_app "https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/api-server/src/app.ts"
click node_novel_route "https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/api-server/src/routes/novel.ts"
click node_health_route "https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/api-server/src/routes/health.ts"

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_reader,node_library,node_novel_detail,node_download_screen,node_updates,node_settings toneBlue
class node_api_dispatch,node_direct_scraper,node_scraper_registry,node_source_adapters,node_webview_bridge toneAmber
class node_reader_screen,node_chapter_state,node_dictionary,node_glossary,node_tts toneMint
class node_api_app,node_novel_route,node_health_route toneRose
class node_external_sources toneIndigo
```

## Components

### Novel Reader App

- [Reader App](https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/app/(tabs)/index.tsx): `artifacts/novel-reader/app/(tabs)/index.tsx`
- [Library](https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/context/LibraryContext.tsx): `artifacts/novel-reader/context/LibraryContext.tsx`
- [Novel Index](https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/app/novel/%5Bid%5D.tsx): `artifacts/novel-reader/app/novel/[id].tsx`
- [Add Novels](https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/app/(tabs)/add.tsx): `artifacts/novel-reader/app/(tabs)/add.tsx`
- [Updates](https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/app/(tabs)/updates.tsx): `artifacts/novel-reader/app/(tabs)/updates.tsx`
- [Settings](https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/app/(tabs)/settings.tsx): `artifacts/novel-reader/app/(tabs)/settings.tsx`

### Novel Acquisition

- [Scraper Dispatch](https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/hooks/useApi.ts): `artifacts/novel-reader/hooks/useApi.ts`
- [Direct Scraper](https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/hooks/useDirectScraper.ts): `artifacts/novel-reader/hooks/useDirectScraper.ts`
- [Source Registry](https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/hooks/scrapers/registry.ts): `artifacts/novel-reader/hooks/scrapers/registry.ts`
- [Source Adapters](https://github.com/moggle-khraum/noveldr/tree/dev5.5/artifacts/novel-reader/hooks/scrapers/sources): `artifacts/novel-reader/hooks/scrapers/sources`
- [WebView Bridge](https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/hooks/scrapers/shared/webviewBridge.tsx): `artifacts/novel-reader/hooks/scrapers/shared/webviewBridge.tsx`

### Reading Features

- [Chapter Reader](https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/app/reader/%5Bid%5D.tsx): `artifacts/novel-reader/app/reader/[id].tsx`
- [Chapter Persistence](https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/hooks/reader/useChapterPersistence.ts): `artifacts/novel-reader/hooks/reader/useChapterPersistence.ts`
- [Dictionary Lookup](https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/hooks/reader/useDictionary.ts): `artifacts/novel-reader/hooks/reader/useDictionary.ts`
- [Personal Glossary](https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/hooks/reader/useGlossary.ts): `artifacts/novel-reader/hooks/reader/useGlossary.ts`
- [Text To Speech](https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/novel-reader/hooks/reader/useTTS.ts): `artifacts/novel-reader/hooks/reader/useTTS.ts`

### API Server

- [API Application](https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/api-server/src/app.ts): `artifacts/api-server/src/app.ts`
- [Novel Scraping Route](https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/api-server/src/routes/novel.ts): `artifacts/api-server/src/routes/novel.ts`
- [Health Route](https://github.com/moggle-khraum/noveldr/blob/dev5.5/artifacts/api-server/src/routes/health.ts): `artifacts/api-server/src/routes/health.ts`

### Other components

- **Novel Websites**

## Connections

- Reader App → Add Novels: opens download
- Add Novels → Scraper Dispatch: requests novel
- Scraper Dispatch → Source Registry: checks source (evidence: `artifacts/novel-reader/hooks/useApi.ts`)
- Scraper Dispatch → Direct Scraper: falls back (evidence: `artifacts/novel-reader/hooks/useApi.ts`)
- Scraper Dispatch → WebView Bridge: checks site (evidence: `artifacts/novel-reader/hooks/useApi.ts`)
- Source Registry → Source Adapters: dispatches to (evidence: `artifacts/novel-reader/hooks/scrapers/registry.ts`)
- Direct Scraper → Novel Websites: fetches pages
- Source Adapters → Novel Websites: scrapes pages
- WebView Bridge → Novel Websites: loads pages
- Add Novels → Library: adds novels
- Library → Novel Index: shows index
- Novel Index → Chapter Reader: opens chapters
- Chapter Reader → Chapter Persistence: tracks progress
- Chapter Reader → Dictionary Lookup: looks up words
- Dictionary Lookup → Personal Glossary: uses glossary (evidence: `artifacts/novel-reader/hooks/reader/useDictionary.ts`)
- Chapter Reader → Text To Speech: reads aloud
- API Application → Novel Scraping Route: mounts routes (evidence: `artifacts/api-server/src/app.ts`)
- API Application → Health Route: mounts routes
- Novel Scraping Route → Novel Websites: fetches chapters
- Reader App → Updates: opens updates
- Reader App → Settings: opens settings
