# rinterface/shinyheatmap architecture

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

- Interactive diagram: https://gitdiagram.com/rinterface/shinyheatmap
- Repository: https://github.com/rinterface/shinyheatmap

## Overview

shinyHeatmap is an R package for recording Shiny app interactions and previewing persistent heatmaps. The main workflow wraps the app UI, captures normalized browser coordinates, stores session logs locally, then aggregates compatible sessions into a heatmap preview. The graph includes the client-side capture/rendering layer and the documented preview controls. R implementation details beyond the README workflow were not sampled, so those links are supported by README statements rather than claims about unseen calls.

Main entry points: [`srcjs/exts/shiny-heatmap.js`](https://github.com/rinterface/shinyheatmap/blob/main/srcjs/exts/shiny-heatmap.js) (JS capture and display), [`R/heatmap.R`](https://github.com/rinterface/shinyheatmap/blob/main/R/heatmap.R) (Server processing), [`R/utils.R`](https://github.com/rinterface/shinyheatmap/blob/main/R/utils.R) (Heatmap utilities), [`inst/heatmap.js-2.0.5/shiny-heatmap.js`](https://github.com/rinterface/shinyheatmap/blob/main/inst/heatmap.js-2.0.5/shiny-heatmap.js) (Shipped client bundle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_integration["Shiny integration"]
  node_uiwrap["UI wrapper<br/>[heatmap.R]"]
  node_serverprocess["Server processing<br/>[heatmap.R]"]
  node_helpers["Heatmap utilities<br/>[utils.R]"]
end

subgraph group_capture["Browser capture"]
  node_client["JS capture and display<br/>[shiny-heatmap.js]"]
  node_runtimejs["Shipped client bundle<br/>[shiny-heatmap.js]"]
end

subgraph group_persistence["Session data"]
  node_sessionlogs[("Session JSON logs")]
end

subgraph group_preview["Heatmap preview"]
  node_previewdownload["Preview generation<br/>[heatmap.R]"]
  node_heatmapoutput["Heatmap image"]
  node_previewcontrols["Preview controls<br/>[shiny-heatmap.js]"]
end

node_app(("Shiny app"))
node_browser(("Browser session"))

node_app -->|"wraps UI with"| node_uiwrap
node_app -->|"calls"| node_serverprocess
node_uiwrap -->|"includes dependencies"| node_client
node_browser -->|"provides interactions"| node_client
node_client -->|"sends coordinates"| node_serverprocess
node_serverprocess -->|"writes session logs"| node_sessionlogs
node_previewdownload -->|"reads logs"| node_sessionlogs
node_serverprocess -->|"dispatches preview"| node_previewdownload
node_previewdownload -->|"generates PNG"| node_heatmapoutput
node_previewdownload -->|"sends heatmap data"| node_client
node_client -->|"renders controls"| node_previewcontrols
node_client -.->|"is bundled as"| node_runtimejs
node_serverprocess -.->|"uses utilities"| node_helpers

click node_uiwrap "https://github.com/rinterface/shinyheatmap/blob/main/R/heatmap.R"
click node_serverprocess "https://github.com/rinterface/shinyheatmap/blob/main/R/heatmap.R"
click node_client "https://github.com/rinterface/shinyheatmap/blob/main/srcjs/exts/shiny-heatmap.js"
click node_runtimejs "https://github.com/rinterface/shinyheatmap/blob/main/inst/heatmap.js-2.0.5/shiny-heatmap.js"
click node_previewdownload "https://github.com/rinterface/shinyheatmap/blob/main/R/heatmap.R"
click node_previewcontrols "https://github.com/rinterface/shinyheatmap/blob/main/srcjs/exts/shiny-heatmap.js"
click node_helpers "https://github.com/rinterface/shinyheatmap/blob/main/R/utils.R"

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_uiwrap,node_serverprocess,node_helpers,node_browser toneBlue
class node_client,node_runtimejs toneAmber
class node_sessionlogs toneMint
class node_previewdownload,node_heatmapoutput,node_previewcontrols toneRose
class node_app toneIndigo
```

## Components

### Shiny integration

- [UI wrapper](https://github.com/rinterface/shinyheatmap/blob/main/R/heatmap.R): `R/heatmap.R`
- [Server processing](https://github.com/rinterface/shinyheatmap/blob/main/R/heatmap.R): `R/heatmap.R`
- [Heatmap utilities](https://github.com/rinterface/shinyheatmap/blob/main/R/utils.R): `R/utils.R`

### Browser capture

- [JS capture and display](https://github.com/rinterface/shinyheatmap/blob/main/srcjs/exts/shiny-heatmap.js): `srcjs/exts/shiny-heatmap.js`
- [Shipped client bundle](https://github.com/rinterface/shinyheatmap/blob/main/inst/heatmap.js-2.0.5/shiny-heatmap.js): `inst/heatmap.js-2.0.5/shiny-heatmap.js`

### Session data

- **Session JSON logs**

### Heatmap preview

- [Preview generation](https://github.com/rinterface/shinyheatmap/blob/main/R/heatmap.R): `R/heatmap.R`
- **Heatmap image**
- [Preview controls](https://github.com/rinterface/shinyheatmap/blob/main/srcjs/exts/shiny-heatmap.js): `srcjs/exts/shiny-heatmap.js`

### Other components

- **Shiny app**
- **Browser session**

## Connections

- Shiny app → UI wrapper: wraps UI with (evidence: `README.md`)
- Shiny app → Server processing: calls (evidence: `README.md`)
- UI wrapper → JS capture and display: includes dependencies (evidence: `README.md`)
- Browser session → JS capture and display: provides interactions (evidence: `srcjs/exts/shiny-heatmap.js`)
- JS capture and display → Server processing: sends coordinates (evidence: `README.md`)
- Server processing → Session JSON logs: writes session logs (evidence: `README.md`)
- Preview generation → Session JSON logs: reads logs (evidence: `README.md`)
- Server processing → Preview generation: dispatches preview (evidence: `README.md`)
- Preview generation → Heatmap image: generates PNG (evidence: `README.md`)
- Preview generation → JS capture and display: sends heatmap data (evidence: `README.md`)
- JS capture and display → Preview controls: renders controls (evidence: `srcjs/exts/shiny-heatmap.js`)
- JS capture and display → Shipped client bundle: is bundled as
- Server processing → Heatmap utilities: uses utilities
