# sorrychoe/wordcard architecture

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

- Interactive diagram: https://gitdiagram.com/sorrychoe/wordcard
- Repository: https://github.com/sorrychoe/wordcard

## Overview

WordCard is a native desktop and command-line app for turning sermon text into editable, templated scripture cards, then saving PNGs or publishing them to Instagram. The principal workflow runs from input through parsing, layout and rendering into preview/editing, followed by local export or an optional upload flow. The graph preserves project recovery, account settings, and the documented template and scripture-recognition capabilities. Relationships for unsampled UI behavior rely on the README or SOURCE INDEX; external API edges are documented capabilities.

Main entry points: [`src/wordcard/ui/main_window.py`](https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/ui/main_window.py) (Main window), [`src/wordcard/ui/upload_dialog.py`](https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/ui/upload_dialog.py) (Upload dialog), [`src/wordcard/main.py`](https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/main.py) (CLI entry), [`src/wordcard/uploader.py`](https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/uploader.py) (Instagram uploader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_creation["Card Creation"]
  node_parser["Text parser<br/>[parser.py]"]
  node_scripture["Scripture references<br/>[bible_books.py]"]
  node_layout["Card layout<br/>[layout.py]"]
  node_templates["Card templates"]
  node_renderer["Image renderer<br/>[renderer.py]"]
  node_exporter["PNG export<br/>[exporter.py]"]
end

subgraph group_desktop["Desktop Workflow"]
  node_cli["CLI entry<br/>[main.py]"]
  node_window["Main window<br/>[main_window.py]"]
  node_common["UI workers<br/>[common.py]"]
  node_settingsui["Settings dialog<br/>[settings_dialog.py]"]
end

subgraph group_state["Projects and Settings"]
  node_project["Project files<br/>[project.py]"]
  node_settings[("Settings and secrets<br/>[settings.py]")]
end

subgraph group_publishing["Publishing"]
  node_uploaddialog["Upload dialog<br/>[upload_dialog.py]"]
  node_uploader["Instagram uploader<br/>[uploader.py]"]
  node_instagram{{"Instagram API"}}
  node_imgbb{{"ImgBB hosting"}}
end

node_user(("Church media user"))

node_user -->|"runs"| node_cli
node_user -->|"uses"| node_window
node_cli -->|"parses"| node_parser
node_cli -->|"paginates"| node_layout
node_cli -->|"renders"| node_renderer
node_cli -->|"exports"| node_exporter
node_parser -->|"recognizes"| node_scripture
node_layout -->|"loads"| node_templates
node_renderer -->|"fits text"| node_layout
node_window -->|"creates cards"| node_parser
node_window -->|"paginates"| node_layout
node_window -->|"renders preview"| node_renderer
node_window -->|"saves PNGs"| node_exporter
node_window -->|"loads and saves"| node_project
node_window -->|"loads settings"| node_settings
node_window -->|"opens"| node_settingsui
node_window -->|"opens"| node_uploaddialog
node_settingsui -->|"saves"| node_settings
node_settingsui -->|"tests connection"| node_uploader
node_window -.->|"uses workers"| node_common
node_uploaddialog -->|"runs background work"| node_common
node_uploaddialog -->|"backs up PNGs"| node_exporter
node_uploaddialog -->|"records publication"| node_project
node_uploaddialog -->|"reads credentials"| node_settings
node_uploaddialog -->|"publishes images"| node_uploader
node_uploader -->|"hosts images"| node_imgbb
node_uploader -->|"creates and publishes"| node_instagram

click node_cli "https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/main.py"
click node_window "https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/ui/main_window.py"
click node_common "https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/ui/common.py"
click node_parser "https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/parser.py"
click node_scripture "https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/bible_books.py"
click node_layout "https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/layout.py"
click node_templates "https://github.com/sorrychoe/wordcard/tree/main/templates"
click node_renderer "https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/renderer.py"
click node_exporter "https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/exporter.py"
click node_project "https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/project.py"
click node_settings "https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/settings.py"
click node_settingsui "https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/ui/settings_dialog.py"
click node_uploaddialog "https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/ui/upload_dialog.py"
click node_uploader "https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/uploader.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_parser,node_scripture,node_layout,node_templates,node_renderer,node_exporter,node_user toneBlue
class node_cli,node_window,node_common,node_settingsui toneAmber
class node_project,node_settings toneMint
class node_uploaddialog,node_uploader,node_instagram,node_imgbb toneRose
```

## Components

### Card Creation

- [Text parser](https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/parser.py): `src/wordcard/parser.py`
- [Scripture references](https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/bible_books.py): `src/wordcard/bible_books.py`
- [Card layout](https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/layout.py): `src/wordcard/layout.py`
- [Card templates](https://github.com/sorrychoe/wordcard/tree/main/templates): `templates`
- [Image renderer](https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/renderer.py): `src/wordcard/renderer.py`
- [PNG export](https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/exporter.py): `src/wordcard/exporter.py`

### Desktop Workflow

- [CLI entry](https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/main.py): `src/wordcard/main.py`
- [Main window](https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/ui/main_window.py): `src/wordcard/ui/main_window.py`
- [UI workers](https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/ui/common.py): `src/wordcard/ui/common.py`
- [Settings dialog](https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/ui/settings_dialog.py): `src/wordcard/ui/settings_dialog.py`

### Projects and Settings

- [Project files](https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/project.py): `src/wordcard/project.py`
- [Settings and secrets](https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/settings.py): `src/wordcard/settings.py`

### Publishing

- [Upload dialog](https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/ui/upload_dialog.py): `src/wordcard/ui/upload_dialog.py`
- [Instagram uploader](https://github.com/sorrychoe/wordcard/blob/main/src/wordcard/uploader.py): `src/wordcard/uploader.py`
- **Instagram API**
- **ImgBB hosting**

### Other components

- **Church media user**

## Connections

- Church media user → CLI entry: runs (evidence: `README.md`)
- Church media user → Main window: uses (evidence: `README.md`)
- CLI entry → Text parser: parses (evidence: `src/wordcard/main.py`)
- CLI entry → Card layout: paginates (evidence: `src/wordcard/main.py`)
- CLI entry → Image renderer: renders (evidence: `src/wordcard/main.py`)
- CLI entry → PNG export: exports (evidence: `src/wordcard/main.py`)
- Text parser → Scripture references: recognizes (evidence: `src/wordcard/parser.py`)
- Card layout → Card templates: loads (evidence: `README.md`)
- Image renderer → Card layout: fits text (evidence: `src/wordcard/renderer.py`)
- Main window → Text parser: creates cards (evidence: `src/wordcard/ui/main_window.py`)
- Main window → Card layout: paginates (evidence: `src/wordcard/ui/main_window.py`)
- Main window → Image renderer: renders preview (evidence: `src/wordcard/ui/main_window.py`)
- Main window → PNG export: saves PNGs (evidence: `src/wordcard/ui/main_window.py`)
- Main window → Project files: loads and saves (evidence: `src/wordcard/ui/main_window.py`)
- Main window → Settings and secrets: loads settings (evidence: `src/wordcard/ui/main_window.py`)
- Main window → Settings dialog: opens (evidence: `src/wordcard/ui/main_window.py`)
- Main window → Upload dialog: opens (evidence: `src/wordcard/ui/main_window.py`)
- Settings dialog → Settings and secrets: saves (evidence: `src/wordcard/ui/settings_dialog.py`)
- Settings dialog → Instagram uploader: tests connection (evidence: `src/wordcard/ui/settings_dialog.py`)
- Main window → UI workers: uses workers (evidence: `src/wordcard/ui/main_window.py`)
- Upload dialog → UI workers: runs background work (evidence: `src/wordcard/ui/upload_dialog.py`)
- Upload dialog → PNG export: backs up PNGs (evidence: `src/wordcard/ui/upload_dialog.py`)
- Upload dialog → Project files: records publication (evidence: `src/wordcard/ui/upload_dialog.py`)
- Upload dialog → Settings and secrets: reads credentials (evidence: `src/wordcard/ui/upload_dialog.py`)
- Upload dialog → Instagram uploader: publishes images (evidence: `src/wordcard/ui/upload_dialog.py`)
- Instagram uploader → ImgBB hosting: hosts images (evidence: `README.md`)
- Instagram uploader → Instagram API: creates and publishes (evidence: `README.md`)
