# garaupere/cocopress architecture

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

- Interactive diagram: https://gitdiagram.com/garaupere/cocopress
- Repository: https://github.com/garaupere/cocopress

## Overview

CoCoPress compiles date-bounded news articles into per-publication corpus files, with optional Stanza lemmatization and POS tagging. The primary documented workflow is the local desktop app: select publications and dates, choose an output directory, run the compiler, and inspect the resulting corpus. The sampled desktop code shows Electron dispatching work to a Python worker, which delegates compilation to app.py and writes its archive contents locally. README-described discovery and output stages are included; their internal links are documented rather than inferred from unsampled code. The repository also contains a web download interface, but its backend routes were not sampled.

Main entry points: [`app.py`](https://github.com/garaupere/cocopress/blob/main/app.py) (Corpus compiler), [`desktop_worker.py`](https://github.com/garaupere/cocopress/blob/main/desktop_worker.py) (Python worker), [`renderer/renderer.js`](https://github.com/garaupere/cocopress/blob/main/renderer/renderer.js) (Desktop UI), [`electron-main.js`](https://github.com/garaupere/cocopress/blob/main/electron-main.js) (Electron main)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_desktop["Desktop interface"]
  node_desktop_ui["Desktop UI<br/>[renderer.js]"]
  node_electron["Electron main<br/>[electron-main.js]"]
  node_worker["Python worker<br/>[desktop_worker.py]"]
end

subgraph group_compile["Corpus compilation"]
  node_compiler["Corpus compiler<br/>[app.py]"]
  node_source_catalog["Publication catalog<br/>[app.py]"]
  node_date_filter["Date selection<br/>[app.py]"]
  node_tagging["Stanza tagging<br/>[app.py]"]
end

subgraph group_discovery["Article discovery"]
  node_discovery_order["Discovery strategy<br/>[README.md]"]
  node_rss["RSS discovery<br/>[app.py]"]
  node_sitemap["Sitemap discovery<br/>[app.py]"]
  node_crawler["Controlled crawling<br/>[app.py]"]
  node_article_extract["Article extraction<br/>[app.py]"]
end

subgraph group_outputs["Corpus outputs"]
  node_archive["Corpus archive<br/>[app.py]"]
  node_local_writer["Local corpus writer<br/>[desktop_worker.py]"]
  node_corpus_files["Corpus files<br/>[README.md]"]
end

subgraph group_web["Web interface"]
  node_web_ui["Web download UI<br/>[app.js]"]
  node_web_service["Web API<br/>[app.py]"]
end

node_user(("Researcher"))
node_news_sites(("News websites"))

node_user -->|"selects options"| node_desktop_ui
node_desktop_ui -->|"starts corpus"| node_electron
node_electron -->|"spawns worker"| node_worker
node_worker -->|"delegates to"| node_compiler
node_worker -->|"requests catalog"| node_source_catalog
node_worker -->|"validates dates"| node_compiler
node_compiler -->|"tries first"| node_rss
node_compiler -->|"tries next"| node_sitemap
node_compiler -->|"falls back to"| node_crawler
node_news_sites -->|"provides feeds"| node_rss
node_news_sites -->|"provides sitemaps"| node_sitemap
node_news_sites -->|"serves pages"| node_crawler
node_compiler -->|"extracts articles"| node_article_extract
node_compiler -->|"optionally tags"| node_tagging
node_compiler -->|"builds archive"| node_archive
node_worker -->|"writes archive"| node_local_writer
node_local_writer -->|"creates files"| node_corpus_files
node_user -->|"submits request"| node_web_ui
node_web_ui -->|"calls API"| node_web_service
node_web_service -.->|"fetches articles"| node_news_sites

click node_desktop_ui "https://github.com/garaupere/cocopress/blob/main/renderer/renderer.js"
click node_electron "https://github.com/garaupere/cocopress/blob/main/electron-main.js"
click node_worker "https://github.com/garaupere/cocopress/blob/main/desktop_worker.py"
click node_compiler "https://github.com/garaupere/cocopress/blob/main/app.py"
click node_source_catalog "https://github.com/garaupere/cocopress/blob/main/app.py"
click node_date_filter "https://github.com/garaupere/cocopress/blob/main/app.py"
click node_discovery_order "https://github.com/garaupere/cocopress/blob/main/README.md"
click node_rss "https://github.com/garaupere/cocopress/blob/main/app.py"
click node_sitemap "https://github.com/garaupere/cocopress/blob/main/app.py"
click node_crawler "https://github.com/garaupere/cocopress/blob/main/app.py"
click node_article_extract "https://github.com/garaupere/cocopress/blob/main/app.py"
click node_tagging "https://github.com/garaupere/cocopress/blob/main/app.py"
click node_archive "https://github.com/garaupere/cocopress/blob/main/app.py"
click node_local_writer "https://github.com/garaupere/cocopress/blob/main/desktop_worker.py"
click node_corpus_files "https://github.com/garaupere/cocopress/blob/main/README.md"
click node_web_ui "https://github.com/garaupere/cocopress/blob/main/static/app.js"
click node_web_service "https://github.com/garaupere/cocopress/blob/main/app.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_desktop_ui,node_electron,node_worker toneBlue
class node_compiler,node_source_catalog,node_date_filter,node_tagging toneAmber
class node_discovery_order,node_rss,node_sitemap,node_crawler,node_article_extract toneMint
class node_archive,node_local_writer,node_corpus_files toneRose
class node_web_ui,node_web_service,node_user,node_news_sites toneIndigo
```

## Components

### Desktop interface

- [Desktop UI](https://github.com/garaupere/cocopress/blob/main/renderer/renderer.js): `renderer/renderer.js`
- [Electron main](https://github.com/garaupere/cocopress/blob/main/electron-main.js): `electron-main.js`
- [Python worker](https://github.com/garaupere/cocopress/blob/main/desktop_worker.py): `desktop_worker.py`

### Corpus compilation

- [Corpus compiler](https://github.com/garaupere/cocopress/blob/main/app.py): `app.py`
- [Publication catalog](https://github.com/garaupere/cocopress/blob/main/app.py): `app.py`
- [Date selection](https://github.com/garaupere/cocopress/blob/main/app.py): `app.py`
- [Stanza tagging](https://github.com/garaupere/cocopress/blob/main/app.py): `app.py`

### Article discovery

- [Discovery strategy](https://github.com/garaupere/cocopress/blob/main/README.md): `README.md`
- [RSS discovery](https://github.com/garaupere/cocopress/blob/main/app.py): `app.py`
- [Sitemap discovery](https://github.com/garaupere/cocopress/blob/main/app.py): `app.py`
- [Controlled crawling](https://github.com/garaupere/cocopress/blob/main/app.py): `app.py`
- [Article extraction](https://github.com/garaupere/cocopress/blob/main/app.py): `app.py`

### Corpus outputs

- [Corpus archive](https://github.com/garaupere/cocopress/blob/main/app.py): `app.py`
- [Local corpus writer](https://github.com/garaupere/cocopress/blob/main/desktop_worker.py): `desktop_worker.py`
- [Corpus files](https://github.com/garaupere/cocopress/blob/main/README.md): `README.md`

### Web interface

- [Web download UI](https://github.com/garaupere/cocopress/blob/main/static/app.js): `static/app.js`
- [Web API](https://github.com/garaupere/cocopress/blob/main/app.py): `app.py`

### Other components

- **Researcher**
- **News websites**

## Connections

- Researcher → Desktop UI: selects options (evidence: `README.md`)
- Desktop UI → Electron main: starts corpus (evidence: `renderer/renderer.js`)
- Electron main → Python worker: spawns worker (evidence: `electron-main.js`)
- Python worker → Corpus compiler: delegates to (evidence: `desktop_worker.py`)
- Python worker → Publication catalog: requests catalog (evidence: `desktop_worker.py`)
- Python worker → Corpus compiler: validates dates (evidence: `desktop_worker.py`)
- Corpus compiler → RSS discovery: tries first (evidence: `README.md`)
- Corpus compiler → Sitemap discovery: tries next (evidence: `README.md`)
- Corpus compiler → Controlled crawling: falls back to (evidence: `README.md`)
- News websites → RSS discovery: provides feeds (evidence: `README.md`)
- News websites → Sitemap discovery: provides sitemaps (evidence: `README.md`)
- News websites → Controlled crawling: serves pages (evidence: `README.md`)
- Corpus compiler → Article extraction: extracts articles (evidence: `app.py`)
- Corpus compiler → Stanza tagging: optionally tags (evidence: `README.md`)
- Corpus compiler → Corpus archive: builds archive (evidence: `app.py`)
- Python worker → Local corpus writer: writes archive (evidence: `desktop_worker.py`)
- Local corpus writer → Corpus files: creates files (evidence: `README.md`)
- Researcher → Web download UI: submits request (evidence: `static/app.js`)
- Web download UI → Web API: calls API (evidence: `static/app.js`)
- Web API → News websites: fetches articles
