# eternityspring/article-tools architecture

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

- Interactive diagram: https://gitdiagram.com/eternityspring/article-tools
- Repository: https://github.com/eternityspring/article-tools

## Overview

Article Tools is a browser-based suite for creating article covers, QR codes, and platform-formatted Markdown, with an optional local service for saving WeChat drafts. The main publishing workflow is: prepare Markdown, format it in the WeChat tool, submit it to the local server, upload/rewrite images and resolve a cover, then create a WeChat draft. The frontend feature descriptions come from the README; its HTML implementations were not sampled, so internal frontend relationships are omitted.

Main entry points: [`server/publish-wechat.mjs`](https://github.com/eternityspring/article-tools/blob/main/server/publish-wechat.mjs) (Draft creation), [`md-to-wechat.html`](https://github.com/eternityspring/article-tools/blob/main/md-to-wechat.html) (WeChat formatter), [`cover.html`](https://github.com/eternityspring/article-tools/blob/main/cover.html) (Cover generator), [`qrcode.html`](https://github.com/eternityspring/article-tools/blob/main/qrcode.html) (QR generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_creation["Visual creation"]
  node_cover["Cover generator<br/>[cover.html]"]
  node_qr["QR generator<br/>[qrcode.html]"]
end

subgraph group_formatting["Article formatting"]
  node_wechatformat["WeChat formatter<br/>[md-to-wechat.html]"]
  node_xformat["X formatter<br/>[md-to-x.html]"]
end

subgraph group_publishing["Draft publishing"]
  node_draft["Draft creation<br/>[publish-wechat.mjs]"]
  node_images["Image processing<br/>[publish-wechat.mjs]"]
  node_thumb["Cover resolution<br/>[publish-wechat.mjs]"]
  node_token["Token management<br/>[publish-wechat.mjs]"]
end

subgraph group_server["Local service"]
  node_localserver["Local HTTP service<br/>[publish-wechat.mjs]"]
  node_static["Static file serving<br/>[publish-wechat.mjs]"]
  node_request["Draft request handler<br/>[publish-wechat.mjs]"]
end

node_author(("Article author"))
node_wechatapi["WeChat API"]
node_draftstore[("WeChat draft box")]

node_author -->|"creates cover"| node_cover
node_author -->|"creates QR"| node_qr
node_author -->|"formats Markdown"| node_wechatformat
node_author -->|"formats Markdown"| node_xformat
node_author -->|"opens locally"| node_localserver
node_wechatformat -->|"submits draft"| node_request
node_localserver -->|"serves tools"| node_static
node_localserver -->|"routes requests"| node_request
node_request -->|"creates draft"| node_draft
node_draft -->|"gets token"| node_token
node_draft -->|"resolves cover"| node_thumb
node_draft -->|"rewrites images"| node_images
node_token -->|"requests token"| node_wechatapi
node_images -->|"uploads images"| node_wechatapi
node_thumb -->|"uploads cover"| node_wechatapi
node_draft -->|"adds draft"| node_wechatapi
node_wechatapi -->|"stores draft"| node_draftstore

click node_cover "https://github.com/eternityspring/article-tools/blob/main/cover.html"
click node_qr "https://github.com/eternityspring/article-tools/blob/main/qrcode.html"
click node_wechatformat "https://github.com/eternityspring/article-tools/blob/main/md-to-wechat.html"
click node_xformat "https://github.com/eternityspring/article-tools/blob/main/md-to-x.html"
click node_localserver "https://github.com/eternityspring/article-tools/blob/main/server/publish-wechat.mjs"
click node_static "https://github.com/eternityspring/article-tools/blob/main/server/publish-wechat.mjs"
click node_request "https://github.com/eternityspring/article-tools/blob/main/server/publish-wechat.mjs"
click node_draft "https://github.com/eternityspring/article-tools/blob/main/server/publish-wechat.mjs"
click node_images "https://github.com/eternityspring/article-tools/blob/main/server/publish-wechat.mjs"
click node_thumb "https://github.com/eternityspring/article-tools/blob/main/server/publish-wechat.mjs"
click node_token "https://github.com/eternityspring/article-tools/blob/main/server/publish-wechat.mjs"

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_cover,node_qr toneBlue
class node_wechatformat,node_xformat,node_draftstore toneAmber
class node_draft,node_images,node_thumb,node_token,node_wechatapi toneMint
class node_localserver,node_static,node_request toneRose
class node_author toneIndigo
```

## Components

### Visual creation

- [Cover generator](https://github.com/eternityspring/article-tools/blob/main/cover.html): `cover.html`
- [QR generator](https://github.com/eternityspring/article-tools/blob/main/qrcode.html): `qrcode.html`

### Article formatting

- [WeChat formatter](https://github.com/eternityspring/article-tools/blob/main/md-to-wechat.html): `md-to-wechat.html`
- [X formatter](https://github.com/eternityspring/article-tools/blob/main/md-to-x.html): `md-to-x.html`

### Draft publishing

- [Draft creation](https://github.com/eternityspring/article-tools/blob/main/server/publish-wechat.mjs): `server/publish-wechat.mjs`
- [Image processing](https://github.com/eternityspring/article-tools/blob/main/server/publish-wechat.mjs): `server/publish-wechat.mjs`
- [Cover resolution](https://github.com/eternityspring/article-tools/blob/main/server/publish-wechat.mjs): `server/publish-wechat.mjs`
- [Token management](https://github.com/eternityspring/article-tools/blob/main/server/publish-wechat.mjs): `server/publish-wechat.mjs`

### Local service

- [Local HTTP service](https://github.com/eternityspring/article-tools/blob/main/server/publish-wechat.mjs): `server/publish-wechat.mjs`
- [Static file serving](https://github.com/eternityspring/article-tools/blob/main/server/publish-wechat.mjs): `server/publish-wechat.mjs`
- [Draft request handler](https://github.com/eternityspring/article-tools/blob/main/server/publish-wechat.mjs): `server/publish-wechat.mjs`

### Other components

- **Article author**
- **WeChat API**
- **WeChat draft box**

## Connections

- Article author → Cover generator: creates cover (evidence: `README.md`)
- Article author → QR generator: creates QR (evidence: `README.md`)
- Article author → WeChat formatter: formats Markdown (evidence: `README.md`)
- Article author → X formatter: formats Markdown (evidence: `README.md`)
- Article author → Local HTTP service: opens locally (evidence: `README.md`)
- WeChat formatter → Draft request handler: submits draft (evidence: `README.md`)
- Local HTTP service → Static file serving: serves tools (evidence: `server/publish-wechat.mjs`)
- Local HTTP service → Draft request handler: routes requests (evidence: `server/publish-wechat.mjs`)
- Draft request handler → Draft creation: creates draft (evidence: `server/publish-wechat.mjs`)
- Draft creation → Token management: gets token (evidence: `server/publish-wechat.mjs`)
- Draft creation → Cover resolution: resolves cover (evidence: `server/publish-wechat.mjs`)
- Draft creation → Image processing: rewrites images (evidence: `server/publish-wechat.mjs`)
- Token management → WeChat API: requests token (evidence: `server/publish-wechat.mjs`)
- Image processing → WeChat API: uploads images (evidence: `server/publish-wechat.mjs`)
- Cover resolution → WeChat API: uploads cover (evidence: `server/publish-wechat.mjs`)
- Draft creation → WeChat API: adds draft (evidence: `server/publish-wechat.mjs`)
- WeChat API → WeChat draft box: stores draft (evidence: `README.md`)
