# gbrath23/templategenerator architecture

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

- Interactive diagram: https://gitdiagram.com/gbrath23/templategenerator
- Repository: https://github.com/gbrath23/templategenerator

## Overview

TemplateGenerator is an Electron desktop app intended to turn a selected CSV into hierarchical CTGO and JSON template files. The user selects or drops a CSV, chooses output paths, and starts processing through the renderer; the main process handles dialogs and processing IPC, while TemplateScript.js parses rows and constructs labels, nested tags, and notes before writing outputs. A significant wiring mismatch limits this workflow: main.js imports and calls processCsvAndGenerateJson, but TemplateScript.js exports processCsvAndGenerateFiles, so processing currently fails. Source excerpts do not establish further UI markup or progress behavior.

Main entry points: [`main.js`](https://github.com/gbrath23/templategenerator/blob/main/main.js) (Window, dialogs, IPC), [`renderer.js`](https://github.com/gbrath23/templategenerator/blob/main/renderer.js) (File selection and status UI), [`TemplateScript.js`](https://github.com/gbrath23/templategenerator/blob/main/TemplateScript.js) (CSV template generator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Desktop interface"]
  node_renderer["File selection and status UI<br/>[renderer.js]"]
end

subgraph group_host["Electron host"]
  node_main["Window, dialogs, IPC<br/>[main.js]"]
end

subgraph group_conversion["CSV conversion"]
  node_generator["CSV template generator<br/>[TemplateScript.js]"]
end

node_user(("User"))
node_csv["CSV input"]
node_ctgo["CTGO output"]
node_json["JSON output"]

node_user -->|"selects files"| node_renderer
node_renderer -->|"invokes dialogs"| node_main
node_main -->|"returns paths"| node_renderer
node_renderer -->|"sends process event"| node_main
node_main -->|"calls missing export"| node_generator
node_generator -->|"reads"| node_csv
node_generator -->|"writes encoded data"| node_ctgo
node_generator -->|"writes formatted data"| node_json
node_main -->|"replies status"| node_renderer

click node_renderer "https://github.com/gbrath23/templategenerator/blob/main/renderer.js"
click node_main "https://github.com/gbrath23/templategenerator/blob/main/main.js"
click node_generator "https://github.com/gbrath23/templategenerator/blob/main/TemplateScript.js"

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_renderer,node_user toneBlue
class node_main toneAmber
class node_generator toneMint
class node_csv,node_ctgo,node_json toneIndigo
```

## Components

### Desktop interface

- [File selection and status UI](https://github.com/gbrath23/templategenerator/blob/main/renderer.js): `renderer.js`

### Electron host

- [Window, dialogs, IPC](https://github.com/gbrath23/templategenerator/blob/main/main.js): `main.js`

### CSV conversion

- [CSV template generator](https://github.com/gbrath23/templategenerator/blob/main/TemplateScript.js): `TemplateScript.js`

### Other components

- **User**
- **CSV input**
- **CTGO output**
- **JSON output**

## Connections

- User → File selection and status UI: selects files
- File selection and status UI → Window, dialogs, IPC: invokes dialogs
- Window, dialogs, IPC → File selection and status UI: returns paths
- File selection and status UI → Window, dialogs, IPC: sends process event
- Window, dialogs, IPC → CSV template generator: calls missing export
- CSV template generator → CSV input: reads
- CSV template generator → CTGO output: writes encoded data
- CSV template generator → JSON output: writes formatted data
- Window, dialogs, IPC → File selection and status UI: replies status
