# r14bz/terminator architecture

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

- Interactive diagram: https://gitdiagram.com/r14bz/terminator
- Repository: https://github.com/r14bz/terminator

## Overview

Terminator is a browser-based network-topology simulator focused on FTTH, Metro Ethernet, MikroTik, switching, and client/IoT networks. Users build a topology with device and cable tools, configure devices, then run the simulation or inspect calculated optical power and topology diagnostics; troubleshooting and auto-fix help resolve issues. The map also includes the documented terminal, templates, glossary, and AI assistance. Several UI and runtime modules are unsampled, so those capability links rely on README statements; edges are limited to documented or indexed wiring.

Main entry points: [`src/App.tsx`](https://github.com/r14bz/terminator/blob/main/src/App.tsx) (Simulator workspace), [`src/components/Canvas.tsx`](https://github.com/r14bz/terminator/blob/main/src/components/Canvas.tsx) (Topology canvas), [`src/components/NodeInspector.tsx`](https://github.com/r14bz/terminator/blob/main/src/components/NodeInspector.tsx) (Device configuration), [`src/utils/topologyValidator.ts`](https://github.com/r14bz/terminator/blob/main/src/utils/topologyValidator.ts) (Topology validator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_editor["Topology editor"]
  node_app["Simulator workspace<br/>[App.tsx]"]
  node_palette["Device palette<br/>[DevicePalette.tsx]"]
  node_cabletools["Cable tools<br/>[CableToolbar.tsx]"]
  node_canvas["Topology canvas<br/>[Canvas.tsx]"]
  node_nodeconfig["Device configuration<br/>[NodeInspector.tsx]"]
  node_cableconfig["Cable configuration<br/>[CableInspector.tsx]"]
end

subgraph group_network["Network model"]
  node_schema["Network schema<br/>[network.ts]"]
  node_devicecatalog["Device definitions"]
  node_cablecatalog["Cable definitions"]
  node_templates["Topology templates<br/>[templates.ts]"]
  node_dhcp["DHCP assignment<br/>[dhcpAuto.ts]"]
end

subgraph group_analysis["Simulation and diagnostics"]
  node_optics["Optical calculator"]
  node_validator["Topology validator"]
  node_rules["Diagnostic rules<br/>[common.ts]"]
  node_diagnostics["Diagnostic entry"]
  node_autofix["Automatic repair<br/>[autoFix.ts]"]
end

subgraph group_guides["Operations and learning"]
  node_terminal["Interactive terminal<br/>[TerminalModal.tsx]"]
  node_opm["Optical power probe"]
  node_troubleshooting["Troubleshooting guide"]
  node_glossary["Network glossary<br/>[glossary.ts]"]
end

subgraph group_ai["AI assistance"]
  node_aichat["AI chat interface"]
  node_aiservice["AI client service<br/>[aiService.ts]"]
  node_aihandlers["AI request handlers<br/>[aiHandlers.ts]"]
  node_aiapi["AI API routes<br/>[chat.ts]"]
  node_aidiagapi["AI diagnosis route<br/>[diagnose.ts]"]
end

node_user(("Network designer"))
node_provider(("AI provider"))

node_user -->|"uses"| node_app
node_app -->|"renders"| node_palette
node_app -->|"renders"| node_cabletools
node_app -->|"renders"| node_canvas
node_app -->|"renders"| node_nodeconfig
node_app -->|"renders"| node_cableconfig
node_palette -.->|"offers devices"| node_devicecatalog
node_cabletools -.->|"offers cable types"| node_cablecatalog
node_canvas -->|"renders topology"| node_schema
node_nodeconfig -->|"configures devices"| node_schema
node_nodeconfig -->|"reads definitions"| node_devicecatalog
node_cableconfig -.->|"configures links"| node_schema
node_app -->|"loads templates"| node_templates
node_app -->|"calculates power"| node_optics
node_canvas -->|"calculates power"| node_optics
node_app -->|"runs diagnostics"| node_diagnostics
node_diagnostics -->|"validates topology"| node_validator
node_validator -->|"uses shared rules"| node_rules
node_validator -->|"applies DHCP logic"| node_dhcp
node_app -->|"applies repairs"| node_autofix
node_app -->|"shows probe"| node_opm
node_opm -.->|"displays readings"| node_optics
node_app -->|"offers guidance"| node_troubleshooting
node_troubleshooting -->|"offers repairs"| node_autofix
node_app -->|"offers CLI"| node_terminal
node_app -->|"offers glossary"| node_glossary
node_app -->|"opens chat"| node_aichat
node_aichat -->|"sends requests"| node_aiservice
node_aiservice -->|"posts chat"| node_aiapi
node_aiservice -->|"posts diagnosis"| node_aidiagapi
node_aiapi -->|"delegates"| node_aihandlers
node_aidiagapi -->|"delegates"| node_aihandlers
node_aihandlers -->|"calls AI service"| node_provider

click node_app "https://github.com/r14bz/terminator/blob/main/src/App.tsx"
click node_palette "https://github.com/r14bz/terminator/blob/main/src/components/DevicePalette.tsx"
click node_cabletools "https://github.com/r14bz/terminator/blob/main/src/components/CableToolbar.tsx"
click node_canvas "https://github.com/r14bz/terminator/blob/main/src/components/Canvas.tsx"
click node_nodeconfig "https://github.com/r14bz/terminator/blob/main/src/components/NodeInspector.tsx"
click node_cableconfig "https://github.com/r14bz/terminator/blob/main/src/components/CableInspector.tsx"
click node_schema "https://github.com/r14bz/terminator/blob/main/src/types/network.ts"
click node_devicecatalog "https://github.com/r14bz/terminator/blob/main/src/data/deviceDefinitions.ts"
click node_cablecatalog "https://github.com/r14bz/terminator/blob/main/src/data/cableDefinitions.ts"
click node_templates "https://github.com/r14bz/terminator/blob/main/src/data/templates.ts"
click node_dhcp "https://github.com/r14bz/terminator/blob/main/src/utils/dhcpAuto.ts"
click node_optics "https://github.com/r14bz/terminator/blob/main/src/utils/opticalCalculator.ts"
click node_validator "https://github.com/r14bz/terminator/blob/main/src/utils/topologyValidator.ts"
click node_rules "https://github.com/r14bz/terminator/blob/main/src/rules/common.ts"
click node_diagnostics "https://github.com/r14bz/terminator/blob/main/src/utils/diagnosticEngine.ts"
click node_autofix "https://github.com/r14bz/terminator/blob/main/src/utils/autoFix.ts"
click node_terminal "https://github.com/r14bz/terminator/blob/main/src/components/TerminalModal.tsx"
click node_opm "https://github.com/r14bz/terminator/blob/main/src/components/OPMFloatingTool.tsx"
click node_troubleshooting "https://github.com/r14bz/terminator/blob/main/src/components/TroubleshootingModal.tsx"
click node_glossary "https://github.com/r14bz/terminator/blob/main/src/data/glossary.ts"
click node_aichat "https://github.com/r14bz/terminator/blob/main/src/components/NetworkAIChatModal.tsx"
click node_aiservice "https://github.com/r14bz/terminator/blob/main/src/utils/aiService.ts"
click node_aihandlers "https://github.com/r14bz/terminator/blob/main/server/aiHandlers.ts"
click node_aiapi "https://github.com/r14bz/terminator/blob/main/api/ai/chat.ts"
click node_aidiagapi "https://github.com/r14bz/terminator/blob/main/api/ai/diagnose.ts"

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_app,node_palette,node_cabletools,node_canvas,node_nodeconfig,node_cableconfig toneBlue
class node_schema,node_devicecatalog,node_cablecatalog,node_templates,node_dhcp toneAmber
class node_optics,node_validator,node_rules,node_diagnostics,node_autofix toneMint
class node_terminal,node_opm,node_troubleshooting,node_glossary toneRose
class node_aichat,node_aiservice,node_aihandlers,node_aiapi,node_aidiagapi,node_user,node_provider toneIndigo
```

## Components

### Topology editor

- [Simulator workspace](https://github.com/r14bz/terminator/blob/main/src/App.tsx): `src/App.tsx`
- [Device palette](https://github.com/r14bz/terminator/blob/main/src/components/DevicePalette.tsx): `src/components/DevicePalette.tsx`
- [Cable tools](https://github.com/r14bz/terminator/blob/main/src/components/CableToolbar.tsx): `src/components/CableToolbar.tsx`
- [Topology canvas](https://github.com/r14bz/terminator/blob/main/src/components/Canvas.tsx): `src/components/Canvas.tsx`
- [Device configuration](https://github.com/r14bz/terminator/blob/main/src/components/NodeInspector.tsx): `src/components/NodeInspector.tsx`
- [Cable configuration](https://github.com/r14bz/terminator/blob/main/src/components/CableInspector.tsx): `src/components/CableInspector.tsx`

### Network model

- [Network schema](https://github.com/r14bz/terminator/blob/main/src/types/network.ts): `src/types/network.ts`
- [Device definitions](https://github.com/r14bz/terminator/blob/main/src/data/deviceDefinitions.ts): `src/data/deviceDefinitions.ts`
- [Cable definitions](https://github.com/r14bz/terminator/blob/main/src/data/cableDefinitions.ts): `src/data/cableDefinitions.ts`
- [Topology templates](https://github.com/r14bz/terminator/blob/main/src/data/templates.ts): `src/data/templates.ts`
- [DHCP assignment](https://github.com/r14bz/terminator/blob/main/src/utils/dhcpAuto.ts): `src/utils/dhcpAuto.ts`

### Simulation and diagnostics

- [Optical calculator](https://github.com/r14bz/terminator/blob/main/src/utils/opticalCalculator.ts): `src/utils/opticalCalculator.ts`
- [Topology validator](https://github.com/r14bz/terminator/blob/main/src/utils/topologyValidator.ts): `src/utils/topologyValidator.ts`
- [Diagnostic rules](https://github.com/r14bz/terminator/blob/main/src/rules/common.ts): `src/rules/common.ts`
- [Diagnostic entry](https://github.com/r14bz/terminator/blob/main/src/utils/diagnosticEngine.ts): `src/utils/diagnosticEngine.ts`
- [Automatic repair](https://github.com/r14bz/terminator/blob/main/src/utils/autoFix.ts): `src/utils/autoFix.ts`

### Operations and learning

- [Interactive terminal](https://github.com/r14bz/terminator/blob/main/src/components/TerminalModal.tsx): `src/components/TerminalModal.tsx`
- [Optical power probe](https://github.com/r14bz/terminator/blob/main/src/components/OPMFloatingTool.tsx): `src/components/OPMFloatingTool.tsx`
- [Troubleshooting guide](https://github.com/r14bz/terminator/blob/main/src/components/TroubleshootingModal.tsx): `src/components/TroubleshootingModal.tsx`
- [Network glossary](https://github.com/r14bz/terminator/blob/main/src/data/glossary.ts): `src/data/glossary.ts`

### AI assistance

- [AI chat interface](https://github.com/r14bz/terminator/blob/main/src/components/NetworkAIChatModal.tsx): `src/components/NetworkAIChatModal.tsx`
- [AI client service](https://github.com/r14bz/terminator/blob/main/src/utils/aiService.ts): `src/utils/aiService.ts`
- [AI request handlers](https://github.com/r14bz/terminator/blob/main/server/aiHandlers.ts): `server/aiHandlers.ts`
- [AI API routes](https://github.com/r14bz/terminator/blob/main/api/ai/chat.ts): `api/ai/chat.ts`
- [AI diagnosis route](https://github.com/r14bz/terminator/blob/main/api/ai/diagnose.ts): `api/ai/diagnose.ts`

### Other components

- **Network designer**
- **AI provider**

## Connections

- Network designer → Simulator workspace: uses (evidence: `README.md`)
- Simulator workspace → Device palette: renders (evidence: `src/App.tsx`)
- Simulator workspace → Cable tools: renders (evidence: `src/App.tsx`)
- Simulator workspace → Topology canvas: renders (evidence: `src/App.tsx`)
- Simulator workspace → Device configuration: renders (evidence: `src/App.tsx`)
- Simulator workspace → Cable configuration: renders (evidence: `src/App.tsx`)
- Device palette → Device definitions: offers devices
- Cable tools → Cable definitions: offers cable types
- Topology canvas → Network schema: renders topology (evidence: `src/components/Canvas.tsx`)
- Device configuration → Network schema: configures devices (evidence: `src/components/NodeInspector.tsx`)
- Device configuration → Device definitions: reads definitions (evidence: `src/components/NodeInspector.tsx`)
- Cable configuration → Network schema: configures links
- Simulator workspace → Topology templates: loads templates (evidence: `src/App.tsx`)
- Simulator workspace → Optical calculator: calculates power (evidence: `src/App.tsx`)
- Topology canvas → Optical calculator: calculates power (evidence: `src/components/Canvas.tsx`)
- Simulator workspace → Diagnostic entry: runs diagnostics (evidence: `src/App.tsx`)
- Diagnostic entry → Topology validator: validates topology (evidence: `src/utils/diagnosticEngine.ts`)
- Topology validator → Diagnostic rules: uses shared rules (evidence: `src/utils/topologyValidator.ts`)
- Topology validator → DHCP assignment: applies DHCP logic (evidence: `src/utils/topologyValidator.ts`)
- Simulator workspace → Automatic repair: applies repairs (evidence: `src/App.tsx`)
- Simulator workspace → Optical power probe: shows probe (evidence: `src/App.tsx`)
- Optical power probe → Optical calculator: displays readings
- Simulator workspace → Troubleshooting guide: offers guidance (evidence: `README.md`)
- Troubleshooting guide → Automatic repair: offers repairs (evidence: `src/components/TroubleshootingModal.tsx`)
- Simulator workspace → Interactive terminal: offers CLI (evidence: `README.md`)
- Simulator workspace → Network glossary: offers glossary (evidence: `README.md`)
- Simulator workspace → AI chat interface: opens chat (evidence: `src/App.tsx`)
- AI chat interface → AI client service: sends requests (evidence: `src/components/NetworkAIChatModal.tsx`)
- AI client service → AI API routes: posts chat (evidence: `src/utils/aiService.ts`)
- AI client service → AI diagnosis route: posts diagnosis (evidence: `src/utils/aiService.ts`)
- AI API routes → AI request handlers: delegates (evidence: `api/ai/chat.ts`)
- AI diagnosis route → AI request handlers: delegates (evidence: `api/ai/diagnose.ts`)
- AI request handlers → AI provider: calls AI service (evidence: `server/aiHandlers.ts`)
