# marmargames/calcforge architecture

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

- Interactive diagram: https://gitdiagram.com/marmargames/calcforge
- Repository: https://github.com/marmargames/calcforge

## Overview

CalcForge is a desktop calculator whose workflow runs from expression entry or history selection through evaluation, then displays a formatted result and learning insights. Users can also change angle and exponent-association modes; trigonometric expressions update the unit-circle indicator. The graph separates the Electron shell, interaction panels, calculation and explanation logic, and supporting state. The README lists broad mathematical capabilities, but unsampled files and the HTML wiring were not inspected, so some internal links and feature details are omitted rather than inferred.

Main entry points: [`app.js`](https://github.com/marmargames/calcforge/blob/main/app.js) (App orchestrator), [`ui/input-panel.js`](https://github.com/marmargames/calcforge/blob/main/ui/input-panel.js) (Expression input), [`ui/result-panel.js`](https://github.com/marmargames/calcforge/blob/main/ui/result-panel.js) (Result and circle), [`ui/insight-panel.js`](https://github.com/marmargames/calcforge/blob/main/ui/insight-panel.js) (Insight panel)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shell["Desktop shell"]
  node_electron["Electron window<br/>[main.js]"]
  node_document["Calculator document<br/>[index.html]"]
end

subgraph group_interaction["Calculator interface"]
  node_app["App orchestrator<br/>[app.js]"]
  node_input["Expression input<br/>[input-panel.js]"]
  node_result["Result and circle<br/>[result-panel.js]"]
  node_insight["Insight panel<br/>[insight-panel.js]"]
end

subgraph group_calculation["Calculation and learning"]
  node_evaluator["Expression evaluator<br/>[evaluator.js]"]
  node_formatter["Result formatter<br/>[formatter.js]"]
  node_steps["Step explanations<br/>[steps.js]"]
end

subgraph group_support["State and assistance"]
  node_modes["Display and angle modes<br/>[modes.js]"]
  node_history[("Calculation history<br/>[history.js]")]
  node_suggestions["Input suggestions<br/>[suggestions.js]"]
end

node_user(("Calculator user"))

node_electron -->|"loads"| node_document
node_user -->|"enters expressions"| node_input
node_app -->|"initializes"| node_input
node_app -->|"initializes"| node_result
node_input -->|"submits expressions"| node_app
node_app -->|"evaluates"| node_evaluator
node_evaluator -->|"formats via"| node_formatter
node_app -->|"shows outcomes"| node_result
node_app -->|"records results"| node_history
node_app -->|"renders history"| node_input
node_input -->|"reads entries"| node_history
node_input -->|"gets suggestions"| node_suggestions
node_result -->|"sets angle mode"| node_modes
node_app -->|"reads modes"| node_modes
node_app -->|"renders insights"| node_insight
node_insight -->|"gets explanations"| node_steps
node_insight -->|"reads display mode"| node_modes
node_steps -->|"formats steps"| node_formatter
node_result -->|"checks alternatives"| node_evaluator
node_user -->|"changes settings"| node_result

click node_electron "https://github.com/marmargames/calcforge/blob/main/main.js"
click node_document "https://github.com/marmargames/calcforge/blob/main/index.html"
click node_app "https://github.com/marmargames/calcforge/blob/main/app.js"
click node_input "https://github.com/marmargames/calcforge/blob/main/ui/input-panel.js"
click node_result "https://github.com/marmargames/calcforge/blob/main/ui/result-panel.js"
click node_insight "https://github.com/marmargames/calcforge/blob/main/ui/insight-panel.js"
click node_evaluator "https://github.com/marmargames/calcforge/blob/main/core/evaluator.js"
click node_formatter "https://github.com/marmargames/calcforge/blob/main/core/formatter.js"
click node_steps "https://github.com/marmargames/calcforge/blob/main/core/steps.js"
click node_modes "https://github.com/marmargames/calcforge/blob/main/modules/modes.js"
click node_history "https://github.com/marmargames/calcforge/blob/main/modules/history.js"
click node_suggestions "https://github.com/marmargames/calcforge/blob/main/modules/suggestions.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_electron,node_document,node_user toneBlue
class node_app,node_input,node_result,node_insight toneAmber
class node_evaluator,node_formatter,node_steps toneMint
class node_modes,node_history,node_suggestions toneRose
```

## Components

### Desktop shell

- [Electron window](https://github.com/marmargames/calcforge/blob/main/main.js): `main.js`
- [Calculator document](https://github.com/marmargames/calcforge/blob/main/index.html): `index.html`

### Calculator interface

- [App orchestrator](https://github.com/marmargames/calcforge/blob/main/app.js): `app.js`
- [Expression input](https://github.com/marmargames/calcforge/blob/main/ui/input-panel.js): `ui/input-panel.js`
- [Result and circle](https://github.com/marmargames/calcforge/blob/main/ui/result-panel.js): `ui/result-panel.js`
- [Insight panel](https://github.com/marmargames/calcforge/blob/main/ui/insight-panel.js): `ui/insight-panel.js`

### Calculation and learning

- [Expression evaluator](https://github.com/marmargames/calcforge/blob/main/core/evaluator.js): `core/evaluator.js`
- [Result formatter](https://github.com/marmargames/calcforge/blob/main/core/formatter.js): `core/formatter.js`
- [Step explanations](https://github.com/marmargames/calcforge/blob/main/core/steps.js): `core/steps.js`

### State and assistance

- [Display and angle modes](https://github.com/marmargames/calcforge/blob/main/modules/modes.js): `modules/modes.js`
- [Calculation history](https://github.com/marmargames/calcforge/blob/main/modules/history.js): `modules/history.js`
- [Input suggestions](https://github.com/marmargames/calcforge/blob/main/modules/suggestions.js): `modules/suggestions.js`

### Other components

- **Calculator user**

## Connections

- Electron window → Calculator document: loads (evidence: `main.js`)
- Calculator user → Expression input: enters expressions (evidence: `ui/input-panel.js`)
- App orchestrator → Expression input: initializes (evidence: `app.js`)
- App orchestrator → Result and circle: initializes (evidence: `app.js`)
- Expression input → App orchestrator: submits expressions (evidence: `app.js`)
- App orchestrator → Expression evaluator: evaluates (evidence: `app.js`)
- Expression evaluator → Result formatter: formats via (evidence: `core/evaluator.js`)
- App orchestrator → Result and circle: shows outcomes (evidence: `app.js`)
- App orchestrator → Calculation history: records results (evidence: `app.js`)
- App orchestrator → Expression input: renders history (evidence: `app.js`)
- Expression input → Calculation history: reads entries (evidence: `ui/input-panel.js`)
- Expression input → Input suggestions: gets suggestions (evidence: `ui/input-panel.js`)
- Result and circle → Display and angle modes: sets angle mode (evidence: `ui/result-panel.js`)
- App orchestrator → Display and angle modes: reads modes (evidence: `app.js`)
- App orchestrator → Insight panel: renders insights (evidence: `app.js`)
- Insight panel → Step explanations: gets explanations (evidence: `ui/insight-panel.js`)
- Insight panel → Display and angle modes: reads display mode (evidence: `ui/insight-panel.js`)
- Step explanations → Result formatter: formats steps (evidence: `core/steps.js`)
- Result and circle → Expression evaluator: checks alternatives (evidence: `ui/result-panel.js`)
- Calculator user → Result and circle: changes settings (evidence: `ui/result-panel.js`)
