# theavben/stagecredit architecture

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

- Interactive diagram: https://gitdiagram.com/theavben/stagecredit
- Repository: https://github.com/theavben/stagecredit

## Overview

StageCredit is an Electron stage-timing app: an operator builds and runs a show, then sends the live clock state to presenter and clock-only outputs. The control renderer owns cue and timer behavior; Electron’s main process manages windows and relays state, while the optional LAN server serves browser views and authenticated remote actions. The README documents additional rundown, show-file, customization, and logging capabilities. Some relationships below rely on README documentation because the relevant source sections were not sampled.

Main entry points: [`control-app.js`](https://github.com/theavben/stagecredit/blob/main/control-app.js) (Control panel), [`main.js`](https://github.com/theavben/stagecredit/blob/main/main.js) (Electron main process), [`server.js`](https://github.com/theavben/stagecredit/blob/main/server.js) (LAN HTTP and WebSocket), [`remote-app.js`](https://github.com/theavben/stagecredit/blob/main/remote-app.js) (Phone remote)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operation["Show operation"]
  node_control["Control panel<br/>[control-app.js]"]
  node_cue_ops["Cue management<br/>[control-app.js]"]
  node_timing["Timer and backtiming<br/>[control-app.js]"]
  node_imports["CSV rundown import<br/>[control-app.js]"]
  node_showfiles["Show files<br/>[main.js]"]
  node_operator_settings["Settings and shortcuts<br/>[control-app.js]"]
end

subgraph group_outputs["Clock outputs"]
  node_presenter["Presenter display<br/>[display-app.js]"]
  node_clock_view["Clock-only view<br/>[display-app.js]"]
end

subgraph group_network["LAN access"]
  node_lan_server["LAN HTTP and WebSocket<br/>[server.js]"]
  node_remote["Phone remote<br/>[remote-app.js]"]
end

subgraph group_runtime["Electron runtime"]
  node_main["Electron main process<br/>[main.js]"]
  node_ipc_control["Control IPC bridge<br/>[preload-control.js]"]
  node_ipc_display["Display IPC bridge<br/>[preload-display.js]"]
  node_state_store[("Local settings<br/>[control-app.js]")]
  node_asrun[("As-run log<br/>[asrun.js]")]
end

node_operator(("Operator"))
node_companion(("Bitfocus Companion"))
node_browser_viewer(("LAN display viewer"))

node_operator -->|"operates"| node_control
node_control -->|"edits cues"| node_cue_ops
node_control -->|"runs clock"| node_timing
node_control -->|"imports rundown"| node_imports
node_control -->|"saves and loads"| node_showfiles
node_control -->|"configures"| node_operator_settings
node_control -->|"persists settings"| node_state_store
node_control -->|"uses bridge"| node_ipc_control
node_main -->|"handles control IPC"| node_ipc_control
node_main -->|"provides display IPC"| node_ipc_display
node_control -->|"publishes clock state"| node_main
node_main -->|"opens output window"| node_presenter
node_main -->|"opens output window"| node_clock_view
node_main -->|"appends show events"| node_asrun
node_main -->|"starts server"| node_lan_server
node_main -->|"dispatches remote actions"| node_control
node_lan_server -->|"serves display view"| node_presenter
node_lan_server -->|"serves clock view"| node_clock_view
node_browser_viewer -->|"requests view"| node_lan_server
node_remote -->|"sends actions"| node_lan_server
node_lan_server -->|"sends live state"| node_remote
node_companion -->|"calls action API"| node_lan_server

click node_control "https://github.com/theavben/stagecredit/blob/main/control-app.js"
click node_cue_ops "https://github.com/theavben/stagecredit/blob/main/control-app.js"
click node_timing "https://github.com/theavben/stagecredit/blob/main/control-app.js"
click node_imports "https://github.com/theavben/stagecredit/blob/main/control-app.js"
click node_showfiles "https://github.com/theavben/stagecredit/blob/main/main.js"
click node_operator_settings "https://github.com/theavben/stagecredit/blob/main/control-app.js"
click node_main "https://github.com/theavben/stagecredit/blob/main/main.js"
click node_ipc_control "https://github.com/theavben/stagecredit/blob/main/preload-control.js"
click node_ipc_display "https://github.com/theavben/stagecredit/blob/main/preload-display.js"
click node_state_store "https://github.com/theavben/stagecredit/blob/main/control-app.js"
click node_asrun "https://github.com/theavben/stagecredit/blob/main/asrun.js"
click node_presenter "https://github.com/theavben/stagecredit/blob/main/display-app.js"
click node_clock_view "https://github.com/theavben/stagecredit/blob/main/display-app.js"
click node_lan_server "https://github.com/theavben/stagecredit/blob/main/server.js"
click node_remote "https://github.com/theavben/stagecredit/blob/main/remote-app.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_control,node_cue_ops,node_timing,node_imports,node_showfiles,node_operator_settings,node_browser_viewer toneBlue
class node_presenter,node_clock_view toneAmber
class node_lan_server,node_remote toneMint
class node_main,node_ipc_control,node_ipc_display,node_state_store,node_asrun toneRose
class node_operator,node_companion toneIndigo
```

## Components

### Show operation

- [Control panel](https://github.com/theavben/stagecredit/blob/main/control-app.js): `control-app.js`
- [Cue management](https://github.com/theavben/stagecredit/blob/main/control-app.js): `control-app.js`
- [Timer and backtiming](https://github.com/theavben/stagecredit/blob/main/control-app.js): `control-app.js`
- [CSV rundown import](https://github.com/theavben/stagecredit/blob/main/control-app.js): `control-app.js`
- [Show files](https://github.com/theavben/stagecredit/blob/main/main.js): `main.js`
- [Settings and shortcuts](https://github.com/theavben/stagecredit/blob/main/control-app.js): `control-app.js`

### Clock outputs

- [Presenter display](https://github.com/theavben/stagecredit/blob/main/display-app.js): `display-app.js`
- [Clock-only view](https://github.com/theavben/stagecredit/blob/main/display-app.js): `display-app.js`

### LAN access

- [LAN HTTP and WebSocket](https://github.com/theavben/stagecredit/blob/main/server.js): `server.js`
- [Phone remote](https://github.com/theavben/stagecredit/blob/main/remote-app.js): `remote-app.js`

### Electron runtime

- [Electron main process](https://github.com/theavben/stagecredit/blob/main/main.js): `main.js`
- [Control IPC bridge](https://github.com/theavben/stagecredit/blob/main/preload-control.js): `preload-control.js`
- [Display IPC bridge](https://github.com/theavben/stagecredit/blob/main/preload-display.js): `preload-display.js`
- [Local settings](https://github.com/theavben/stagecredit/blob/main/control-app.js): `control-app.js`
- [As-run log](https://github.com/theavben/stagecredit/blob/main/asrun.js): `asrun.js`

### Other components

- **Operator**
- **Bitfocus Companion**
- **LAN display viewer**

## Connections

- Operator → Control panel: operates (evidence: `README.md`)
- Control panel → Cue management: edits cues (evidence: `README.md`)
- Control panel → Timer and backtiming: runs clock (evidence: `README.md`)
- Control panel → CSV rundown import: imports rundown (evidence: `README.md`)
- Control panel → Show files: saves and loads (evidence: `README.md`)
- Control panel → Settings and shortcuts: configures (evidence: `README.md`)
- Control panel → Local settings: persists settings (evidence: `README.md`)
- Control panel → Control IPC bridge: uses bridge (evidence: `README.md`)
- Electron main process → Control IPC bridge: handles control IPC (evidence: `preload-control.js`)
- Electron main process → Display IPC bridge: provides display IPC (evidence: `preload-display.js`)
- Control panel → Electron main process: publishes clock state (evidence: `main.js`)
- Electron main process → Presenter display: opens output window (evidence: `README.md`)
- Electron main process → Clock-only view: opens output window (evidence: `README.md`)
- Electron main process → As-run log: appends show events (evidence: `main.js`)
- Electron main process → LAN HTTP and WebSocket: starts server (evidence: `main.js`)
- Electron main process → Control panel: dispatches remote actions (evidence: `README.md`)
- LAN HTTP and WebSocket → Presenter display: serves display view (evidence: `README.md`)
- LAN HTTP and WebSocket → Clock-only view: serves clock view (evidence: `README.md`)
- LAN display viewer → LAN HTTP and WebSocket: requests view (evidence: `README.md`)
- Phone remote → LAN HTTP and WebSocket: sends actions (evidence: `remote-app.js`)
- LAN HTTP and WebSocket → Phone remote: sends live state (evidence: `README.md`)
- Bitfocus Companion → LAN HTTP and WebSocket: calls action API (evidence: `README.md`)
