# roodrigoreyes/midtowncomics-cli architecture

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

- Interactive diagram: https://gitdiagram.com/roodrigoreyes/midtowncomics-cli
- Repository: https://github.com/roodrigoreyes/midtowncomics-cli

## Overview

Midtown Comics CLI is a read-only account and catalog client. The principal flow is terminal invocation through Click commands, authenticated HTTP requests, page-specific parsing, and terminal/JSON or file output. Commands also support order analysis, preorders, wishlist/cart/account access, catalog search and cover downloads. Login can reuse saved cookies, automate browser login, or offer an interactive remote login. The graph reflects excerpts and README-described capabilities; unsampled implementation details and some integration wiring are not asserted.

Main entry points: [`midtown/cli.py`](https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/cli.py) (CLI commands), [`midtown/client.py`](https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/client.py) (HTTP client), [`midtown/remote_auth.py`](https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/remote_auth.py) (Browser login), [`midtown/__main__.py`](https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/__main__.py) (Module entrypoint)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["CLI and output"]
  node_entry["Module entrypoint<br/>[__main__.py]"]
  node_commands["CLI commands<br/>[cli.py]"]
  node_render["Result rendering<br/>[output.py]"]
end

subgraph group_commerce["Account and catalog"]
  node_orders["Orders and comics<br/>[client.py]"]
  node_preorders["Preorders<br/>[client.py]"]
  node_cart["Cart<br/>[client.py]"]
  node_wishlist["Wishlist<br/>[client.py]"]
  node_account["Account profile<br/>[client.py]"]
  node_catalog["Catalog search<br/>[client.py]"]
  node_covers["Cover download<br/>[client.py]"]
  node_http["HTTP client<br/>[client.py]"]
end

subgraph group_auth["Authentication"]
  node_browserauth["Browser login<br/>[remote_auth.py]"]
end

subgraph group_parsing["Parsing and persistence"]
  node_parsers["Page parsers<br/>[parsers.py]"]
  node_credentials[("Credentials and sessions<br/>[credentials.py]")]
end

node_user(("Terminal user"))
node_midtown["Midtown Comics"]
node_remote["Remote login access"]

node_user -->|"invokes"| node_entry
node_entry -->|"starts"| node_commands
node_commands -->|"requests"| node_orders
node_commands -->|"requests"| node_preorders
node_commands -->|"requests"| node_cart
node_commands -->|"requests"| node_wishlist
node_commands -->|"requests"| node_account
node_commands -->|"requests"| node_catalog
node_commands -->|"requests"| node_covers
node_commands -->|"formats results"| node_render
node_http -->|"requests pages"| node_midtown
node_http -->|"parses responses"| node_parsers
node_http -->|"loads and saves sessions"| node_credentials
node_http -->|"re-authenticates"| node_browserauth
node_commands -->|"starts remote login"| node_browserauth
node_browserauth -->|"saves cookies"| node_credentials
node_browserauth -->|"offers login through"| node_remote
node_remote -.->|"authenticates"| node_midtown

click node_entry "https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/__main__.py"
click node_commands "https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/cli.py"
click node_render "https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/output.py"
click node_orders "https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/client.py"
click node_preorders "https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/client.py"
click node_cart "https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/client.py"
click node_wishlist "https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/client.py"
click node_account "https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/client.py"
click node_catalog "https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/client.py"
click node_covers "https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/client.py"
click node_http "https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/client.py"
click node_parsers "https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/parsers.py"
click node_credentials "https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/credentials.py"
click node_browserauth "https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/remote_auth.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_entry,node_commands,node_render,node_user toneBlue
class node_orders,node_preorders,node_cart,node_wishlist,node_account,node_catalog,node_covers,node_http toneAmber
class node_browserauth toneMint
class node_parsers,node_credentials toneRose
class node_midtown,node_remote toneIndigo
```

## Components

### CLI and output

- [Module entrypoint](https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/__main__.py): `midtown/__main__.py`
- [CLI commands](https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/cli.py): `midtown/cli.py`
- [Result rendering](https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/output.py): `midtown/output.py`

### Account and catalog

- [Orders and comics](https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/client.py): `midtown/client.py`
- [Preorders](https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/client.py): `midtown/client.py`
- [Cart](https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/client.py): `midtown/client.py`
- [Wishlist](https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/client.py): `midtown/client.py`
- [Account profile](https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/client.py): `midtown/client.py`
- [Catalog search](https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/client.py): `midtown/client.py`
- [Cover download](https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/client.py): `midtown/client.py`
- [HTTP client](https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/client.py): `midtown/client.py`

### Authentication

- [Browser login](https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/remote_auth.py): `midtown/remote_auth.py`

### Parsing and persistence

- [Page parsers](https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/parsers.py): `midtown/parsers.py`
- [Credentials and sessions](https://github.com/roodrigoreyes/midtowncomics-cli/blob/main/midtown/credentials.py): `midtown/credentials.py`

### Other components

- **Terminal user**
- **Midtown Comics**
- **Remote login access**

## Connections

- Terminal user → Module entrypoint: invokes (evidence: `README.md`)
- Module entrypoint → CLI commands: starts (evidence: `midtown/__main__.py`)
- CLI commands → Orders and comics: requests (evidence: `midtown/cli.py`)
- CLI commands → Preorders: requests (evidence: `midtown/cli.py`)
- CLI commands → Cart: requests (evidence: `midtown/cli.py`)
- CLI commands → Wishlist: requests (evidence: `midtown/cli.py`)
- CLI commands → Account profile: requests (evidence: `midtown/cli.py`)
- CLI commands → Catalog search: requests (evidence: `midtown/cli.py`)
- CLI commands → Cover download: requests (evidence: `README.md`)
- CLI commands → Result rendering: formats results (evidence: `midtown/cli.py`)
- HTTP client → Midtown Comics: requests pages (evidence: `midtown/client.py`)
- HTTP client → Page parsers: parses responses (evidence: `midtown/client.py`)
- HTTP client → Credentials and sessions: loads and saves sessions (evidence: `midtown/client.py`)
- HTTP client → Browser login: re-authenticates (evidence: `midtown/client.py`)
- CLI commands → Browser login: starts remote login (evidence: `README.md`)
- Browser login → Credentials and sessions: saves cookies (evidence: `midtown/remote_auth.py`)
- Browser login → Remote login access: offers login through (evidence: `README.md`)
- Remote login access → Midtown Comics: authenticates
