# samael0-dev/transistorlab architecture

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

- Interactive diagram: https://gitdiagram.com/samael0-dev/transistorlab
- Repository: https://github.com/samael0-dev/transistorlab

## Overview

TransistorLab is a browser-based educational simulator. A learner uses the web interface to explore transistor switching, logic and binary addition, amplifier behavior, and artificial and biophysical neuron models; the controller calls the corresponding mathematical models and updates charts and readouts. The README also documents a gallery/lightbox capability. The sampled files show the controller-to-model calls and some model internals; other documented capabilities are included without assuming unshown implementation details.

Main entry points: [`js/app.js`](https://github.com/samael0-dev/transistorlab/blob/main/js/app.js) (UI controller), [`index.html`](https://github.com/samael0-dev/transistorlab/blob/main/index.html) (Application page), [`js/models.js`](https://github.com/samael0-dev/transistorlab/blob/main/js/models.js) (Logic gates), [`assets`](https://github.com/samael0-dev/transistorlab/tree/main/assets) (LTspice references)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Browser interface"]
  node_page["Application page<br/>[index.html]"]
  node_controller["UI controller<br/>[app.js]"]
end

subgraph group_digital["Digital models"]
  node_bjt["BJT switching<br/>[models.js]"]
  node_transfer["Transfer curve<br/>[models.js]"]
  node_gates["Logic gates<br/>[models.js]"]
  node_adder["4-bit adder<br/>[models.js]"]
end

subgraph group_analog["Analog model"]
  node_bias["Amplifier bias<br/>[models.js]"]
  node_waveform["Amplifier waveform<br/>[models.js]"]
end

subgraph group_neural["Neural models"]
  node_perceptron["Artificial neuron<br/>[models.js]"]
  node_lif["LIF dynamics<br/>[models.js]"]
end

subgraph group_presentation["Visualization"]
  node_charts["Chart.js"]
  node_lightbox["Gallery lightbox<br/>[app.js]"]
  node_styles["Responsive styling<br/>[style.css]"]
  node_bench["LTspice references"]
end

node_learner(("Learner"))

node_learner -->|"uses"| node_page
node_page -->|"starts"| node_controller
node_controller -->|"evaluates"| node_bjt
node_controller -->|"requests curve"| node_transfer
node_controller -->|"evaluates"| node_gates
node_controller -->|"calculates"| node_adder
node_controller -->|"calculates"| node_bias
node_controller -->|"generates waveform"| node_waveform
node_controller -->|"evaluates"| node_perceptron
node_controller -->|"simulates"| node_lif
node_controller -->|"configures charts"| node_charts
node_controller -->|"provides"| node_lightbox
node_page -->|"styled by"| node_styles
node_transfer -->|"samples"| node_bjt
node_gates -->|"uses switching model"| node_bjt
node_adder -->|"builds from NAND"| node_gates
node_waveform -->|"uses operating point"| node_bias
node_bench -.->|"illustrates behavior"| node_page

click node_page "https://github.com/samael0-dev/transistorlab/blob/main/index.html"
click node_controller "https://github.com/samael0-dev/transistorlab/blob/main/js/app.js"
click node_bjt "https://github.com/samael0-dev/transistorlab/blob/main/js/models.js"
click node_transfer "https://github.com/samael0-dev/transistorlab/blob/main/js/models.js"
click node_gates "https://github.com/samael0-dev/transistorlab/blob/main/js/models.js"
click node_adder "https://github.com/samael0-dev/transistorlab/blob/main/js/models.js"
click node_bias "https://github.com/samael0-dev/transistorlab/blob/main/js/models.js"
click node_waveform "https://github.com/samael0-dev/transistorlab/blob/main/js/models.js"
click node_perceptron "https://github.com/samael0-dev/transistorlab/blob/main/js/models.js"
click node_lif "https://github.com/samael0-dev/transistorlab/blob/main/js/models.js"
click node_lightbox "https://github.com/samael0-dev/transistorlab/blob/main/js/app.js"
click node_styles "https://github.com/samael0-dev/transistorlab/blob/main/css/style.css"
click node_bench "https://github.com/samael0-dev/transistorlab/tree/main/assets"

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_page,node_controller toneBlue
class node_bjt,node_transfer,node_gates,node_adder toneAmber
class node_bias,node_waveform toneMint
class node_perceptron,node_lif toneRose
class node_charts,node_lightbox,node_styles,node_bench,node_learner toneIndigo
```

## Components

### Browser interface

- [Application page](https://github.com/samael0-dev/transistorlab/blob/main/index.html): `index.html`
- [UI controller](https://github.com/samael0-dev/transistorlab/blob/main/js/app.js): `js/app.js`

### Digital models

- [BJT switching](https://github.com/samael0-dev/transistorlab/blob/main/js/models.js): `js/models.js`
- [Transfer curve](https://github.com/samael0-dev/transistorlab/blob/main/js/models.js): `js/models.js`
- [Logic gates](https://github.com/samael0-dev/transistorlab/blob/main/js/models.js): `js/models.js`
- [4-bit adder](https://github.com/samael0-dev/transistorlab/blob/main/js/models.js): `js/models.js`

### Analog model

- [Amplifier bias](https://github.com/samael0-dev/transistorlab/blob/main/js/models.js): `js/models.js`
- [Amplifier waveform](https://github.com/samael0-dev/transistorlab/blob/main/js/models.js): `js/models.js`

### Neural models

- [Artificial neuron](https://github.com/samael0-dev/transistorlab/blob/main/js/models.js): `js/models.js`
- [LIF dynamics](https://github.com/samael0-dev/transistorlab/blob/main/js/models.js): `js/models.js`

### Visualization

- **Chart.js**
- [Gallery lightbox](https://github.com/samael0-dev/transistorlab/blob/main/js/app.js): `js/app.js`
- [Responsive styling](https://github.com/samael0-dev/transistorlab/blob/main/css/style.css): `css/style.css`
- [LTspice references](https://github.com/samael0-dev/transistorlab/tree/main/assets): `assets`

### Other components

- **Learner**

## Connections

- Learner → Application page: uses (evidence: `README.md`)
- Application page → UI controller: starts (evidence: `README.md`)
- UI controller → BJT switching: evaluates (evidence: `js/app.js`)
- UI controller → Transfer curve: requests curve (evidence: `js/app.js`)
- UI controller → Logic gates: evaluates (evidence: `js/app.js`)
- UI controller → 4-bit adder: calculates (evidence: `js/app.js`)
- UI controller → Amplifier bias: calculates (evidence: `js/app.js`)
- UI controller → Amplifier waveform: generates waveform (evidence: `js/app.js`)
- UI controller → Artificial neuron: evaluates (evidence: `js/app.js`)
- UI controller → LIF dynamics: simulates (evidence: `js/app.js`)
- UI controller → Chart.js: configures charts (evidence: `js/app.js`)
- UI controller → Gallery lightbox: provides (evidence: `README.md`)
- Application page → Responsive styling: styled by (evidence: `README.md`)
- Transfer curve → BJT switching: samples (evidence: `js/models.js`)
- Logic gates → BJT switching: uses switching model (evidence: `js/models.js`)
- 4-bit adder → Logic gates: builds from NAND (evidence: `js/models.js`)
- Amplifier waveform → Amplifier bias: uses operating point (evidence: `js/models.js`)
- LTspice references → Application page: illustrates behavior (evidence: `README.md`)
