# d1gitale/ranoparse architecture

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

- Interactive diagram: https://gitdiagram.com/d1gitale/ranoparse
- Repository: https://github.com/d1gitale/ranoparse

## Overview

#### Purpose and execution
Ranoparse is a Python CLI pipeline that downloads a ranobe from ranobehub.org and produces EPUB volumes in a user-selected output directory. The operational entry points are:
- `init.py` — initializes/persists the download destination.
- `app.py` — accepts a novel’s main-page URL and starts processing.
- `bridge.py` — an application-level integration boundary, likely connecting orchestration with parsing/output behavior.

#### Runtime and dependency boundary
The project runs on Python, with the selected version indicated by `.python-version`. Dependency installation and command execution use uv:
- `pyproject.toml`
- `uv.lock`
- `.python-version`

The principal external service is `ranobehub.org`; its HTML/pages are the upstream content source. EPUB is the promised output format, while the filesystem is the downstream storage boundary.

#### CLI initialization stage
`init.py` separates environment setup from parsing: users first provide a destination directory, then run the parser against a URL. This makes output-location state/configuration a prerequisite for the main workflow rather than an argument repeated on every run.
- `init.py`
- `app.py`

#### Application orchestration
`app.py` is the main control-plane entry point. It should own argument handling, loading the configured destination, invoking the parser, and coordinating output creation. It is the appropriate boundary for user-visible progress/errors and for translating a source URL into a complete multi-volume job.
- `app.py`
- `bridge.py`
- `src/__init__.py`

#### Source acquisition and parsing
The parsing subsystem is centered in `src/parse.py`. Based on the repository purpose, this layer is responsible for interpreting a ranobehub novel page and traversing the content needed to obtain volumes/chapters. It should isolate site-specific document assumptions from CLI orchestration and EPUB generation.
- `src/parse.py`
- `src/helpers.py`

#### Transformation and EPUB output
The primary data flow is: main-page URL → parsed novel metadata/content hierarchy → per-volume chapter content → EPUB artifacts written beneath the configured destination. `bridge.py` is the likely handoff point between parsed domain data and the output/EPUB-facing implementation, keeping source parsing distinct from publication assembly.
- `bridge.py`
- `src/parse.py`
- `app.py`

#### Supporting shared logic
`src/helpers.py` is the shared utility layer for parsing and/or output operations. It should remain below the parser and orchestration layers, rather than becoming another entry point. The `src` package provides the internal module boundary for application logic.
- `src/helpers.py`
- `src/__init__.py`

Main entry points: [`app.py`](https://github.com/d1gitale/ranoparse/blob/main/app.py) (Process novel URL), [`src/parse.py`](https://github.com/d1gitale/ranoparse/blob/main/src/parse.py) (Site parser), [`bridge.py`](https://github.com/d1gitale/ranoparse/blob/main/bridge.py) (Publication bridge), [`init.py`](https://github.com/d1gitale/ranoparse/blob/main/init.py) (Initialize destination)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflow"]
  node_user(("User<br/>actor"))
  node_runtime["Python + uv<br/>runtime<br/>[pyproject.toml]"]
  node_init["Initialize destination<br/>CLI entry point<br/>[init.py]"]
  node_destination_config["Saved destination<br/>application state"]
  node_app["Process novel URL<br/>CLI entry point<br/>[app.py]"]
end

subgraph group_core["Application core"]
  node_src_package["src package<br/>internal package<br/>[__init__.py]"]
  node_parser["Site parser<br/>parsing subsystem<br/>[parse.py]"]
  node_helpers["Shared helpers<br/>utility module<br/>[helpers.py]"]
  node_novel_hierarchy["Novel content hierarchy<br/>domain data"]
  node_bridge["Publication bridge<br/>integration boundary<br/>[bridge.py]"]
end

node_ranobehub{{"ranobehub.org<br/>upstream site"}}
node_epub_volumes["EPUB volumes<br/>publication artifacts"]
node_filesystem[("Selected output directory<br/>storage boundary")]

node_user -->|"selects destination"| node_init
node_init -->|"persists"| node_destination_config
node_user -->|"provides novel URL"| node_app
node_runtime -.->|"runs"| node_init
node_runtime -.->|"runs"| node_app
node_app -->|"loads"| node_destination_config
node_app -->|"starts parsing"| node_parser
node_parser -->|"fetches pages"| node_ranobehub
node_parser -->|"uses"| node_helpers
node_parser -->|"produces"| node_novel_hierarchy
node_app -->|"coordinates output"| node_bridge
node_novel_hierarchy -->|"hands off content"| node_bridge
node_bridge -->|"uses"| node_helpers
node_bridge -->|"assembles"| node_epub_volumes
node_epub_volumes -->|"writes beneath"| node_filesystem
node_destination_config -.->|"identifies"| node_filesystem
node_src_package -.->|"contains"| node_parser
node_src_package -.->|"contains"| node_helpers

click node_runtime "https://github.com/d1gitale/ranoparse/blob/main/pyproject.toml"
click node_init "https://github.com/d1gitale/ranoparse/blob/main/init.py"
click node_app "https://github.com/d1gitale/ranoparse/blob/main/app.py"
click node_src_package "https://github.com/d1gitale/ranoparse/blob/main/src/__init__.py"
click node_parser "https://github.com/d1gitale/ranoparse/blob/main/src/parse.py"
click node_helpers "https://github.com/d1gitale/ranoparse/blob/main/src/helpers.py"
click node_bridge "https://github.com/d1gitale/ranoparse/blob/main/bridge.py"

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_user,node_runtime,node_init,node_destination_config,node_app toneBlue
class node_src_package,node_parser,node_helpers,node_novel_hierarchy,node_bridge toneAmber
class node_ranobehub,node_epub_volumes,node_filesystem toneNeutral
```

## Components

### CLI workflow

- **User**: actor
- [Python + uv](https://github.com/d1gitale/ranoparse/blob/main/pyproject.toml): runtime · Python version and dependency execution boundary. · `pyproject.toml`
- [Initialize destination](https://github.com/d1gitale/ranoparse/blob/main/init.py): CLI entry point · `init.py`
- **Saved destination**: application state · Persisted output-directory selection.
- [Process novel URL](https://github.com/d1gitale/ranoparse/blob/main/app.py): CLI entry point · Coordinates a complete multi-volume job. · `app.py`

### Application core

- [src package](https://github.com/d1gitale/ranoparse/blob/main/src/__init__.py): internal package · `src/__init__.py`
- [Site parser](https://github.com/d1gitale/ranoparse/blob/main/src/parse.py): parsing subsystem · Traverses novel, volume, and chapter pages. · `src/parse.py`
- [Shared helpers](https://github.com/d1gitale/ranoparse/blob/main/src/helpers.py): utility module · `src/helpers.py`
- **Novel content hierarchy**: domain data · Parsed metadata, volumes, and chapters.
- [Publication bridge](https://github.com/d1gitale/ranoparse/blob/main/bridge.py): integration boundary · Hands parsed content to EPUB-facing output behavior. · `bridge.py`

### Other components

- **ranobehub.org**: upstream site · Novel pages and chapter content source.
- **EPUB volumes**: publication artifacts · One or more generated volume files.
- **Selected output directory**: storage boundary

## Connections

- User → Initialize destination: selects destination
- Initialize destination → Saved destination: persists
- User → Process novel URL: provides novel URL
- Python + uv → Initialize destination: runs
- Python + uv → Process novel URL: runs
- Process novel URL → Saved destination: loads
- Process novel URL → Site parser: starts parsing
- Site parser → ranobehub.org: fetches pages
- Site parser → Shared helpers: uses
- Site parser → Novel content hierarchy: produces
- Process novel URL → Publication bridge: coordinates output
- Novel content hierarchy → Publication bridge: hands off content
- Publication bridge → Shared helpers: uses
- Publication bridge → EPUB volumes: assembles
- EPUB volumes → Selected output directory: writes beneath
- Saved destination → Selected output directory: identifies
- src package → Site parser: contains
- src package → Shared helpers: contains
