# aioscout/aioscout-desktop architecture

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

- Interactive diagram: https://gitdiagram.com/aioscout/aioscout-desktop
- Repository: https://github.com/aioscout/aioscout-desktop

## Overview

AIoScout Desktop unifies AI model training and Mixly block coding for the smart car. The user selects a subpage in the shell; the Electron main process starts or reuses its backend and embeds its loopback-served UI. In the training workflow, exported models are collected into a persistent library that Mixly can read for AI Vision blocks. The graph also shows Arduino toolchain setup and the context-isolated IPC boundary. External backend internals are documented but not present in this repository, so their internal stages are omitted.

Main entry points: [`src/main/index.ts`](https://github.com/aioscout/aioscout-desktop/blob/main/src/main/index.ts) (App coordinator), [`src/main/ipc.ts`](https://github.com/aioscout/aioscout-desktop/blob/main/src/main/ipc.ts) (IPC handlers), [`src/main/linkage/modelLibrary.ts`](https://github.com/aioscout/aioscout-desktop/blob/main/src/main/linkage/modelLibrary.ts) (Model library), [`src/preload/index.ts`](https://github.com/aioscout/aioscout-desktop/blob/main/src/preload/index.ts) (Preload bridge)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Desktop interface"]
  node_shell["Shell UI<br/>[main.js]"]
  node_bridge["Preload bridge<br/>[index.ts]"]
  node_views["Embedded views<br/>[windowManager.ts]"]
end

subgraph group_main["Electron orchestration"]
  node_entry["App coordinator<br/>[index.ts]"]
  node_ipc["IPC handlers<br/>[ipc.ts]"]
  node_settings["App settings<br/>[settings.ts]"]
  node_paths["Runtime paths<br/>[paths.ts]"]
  node_types["Shared IPC contract<br/>[types.ts]"]
end

subgraph group_services["Backend services"]
  node_mixly_service["Mixly service<br/>[mixly.ts]"]
  node_training_service["Training service<br/>[training.ts]"]
  node_mixly["Mixly block editor"]
  node_training["Training backend"]
end

subgraph group_models["Model and device workflow"]
  node_export[("Export outbox")]
  node_watcher["Export watcher<br/>[exportWatcher.ts]"]
  node_library[("Model library<br/>[modelLibrary.ts]")]
  node_arduino["Arduino toolchain<br/>[arduinoCli.ts]"]
end

node_user(("User"))
node_car["AIoScout smart car"]

node_user -->|"navigates"| node_shell
node_shell -->|"invokes IPC"| node_bridge
node_bridge -->|"forwards requests"| node_ipc
node_ipc -->|"dispatches actions"| node_entry
node_entry -->|"loads settings"| node_settings
node_entry -->|"resolves paths"| node_paths
node_entry -->|"starts service"| node_mixly_service
node_entry -->|"starts service"| node_training_service
node_entry -->|"selects page"| node_views
node_mixly_service -->|"forks server"| node_mixly
node_training_service -->|"spawns backend"| node_training
node_mixly -->|"serves editor"| node_views
node_training -->|"serves training UI"| node_views
node_training -->|"writes exports"| node_export
node_watcher -->|"watches files"| node_export
node_entry -->|"starts watcher"| node_watcher
node_watcher -->|"imports models"| node_library
node_ipc -->|"manages models"| node_library
node_mixly -->|"reads models"| node_library
node_entry -->|"seeds toolchain"| node_arduino
node_mixly -->|"uses CLI"| node_arduino
node_arduino -->|"uploads firmware"| node_car
node_ipc -->|"uses channel definitions"| node_types
node_bridge -->|"uses channel definitions"| node_types
node_library -->|"notifies changes"| node_shell

click node_shell "https://github.com/aioscout/aioscout-desktop/blob/main/src/renderer/main.js"
click node_bridge "https://github.com/aioscout/aioscout-desktop/blob/main/src/preload/index.ts"
click node_views "https://github.com/aioscout/aioscout-desktop/blob/main/src/main/windowManager.ts"
click node_entry "https://github.com/aioscout/aioscout-desktop/blob/main/src/main/index.ts"
click node_ipc "https://github.com/aioscout/aioscout-desktop/blob/main/src/main/ipc.ts"
click node_settings "https://github.com/aioscout/aioscout-desktop/blob/main/src/main/settings.ts"
click node_paths "https://github.com/aioscout/aioscout-desktop/blob/main/src/main/paths.ts"
click node_mixly_service "https://github.com/aioscout/aioscout-desktop/blob/main/src/main/services/mixly.ts"
click node_training_service "https://github.com/aioscout/aioscout-desktop/blob/main/src/main/services/training.ts"
click node_watcher "https://github.com/aioscout/aioscout-desktop/blob/main/src/main/linkage/exportWatcher.ts"
click node_library "https://github.com/aioscout/aioscout-desktop/blob/main/src/main/linkage/modelLibrary.ts"
click node_arduino "https://github.com/aioscout/aioscout-desktop/blob/main/src/main/arduinoCli.ts"
click node_types "https://github.com/aioscout/aioscout-desktop/blob/main/src/shared/types.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_shell,node_bridge,node_views,node_user toneBlue
class node_entry,node_ipc,node_settings,node_paths,node_types toneAmber
class node_mixly_service,node_training_service,node_mixly,node_training toneMint
class node_export,node_watcher,node_library,node_arduino toneRose
class node_car toneIndigo
```

## Components

### Desktop interface

- [Shell UI](https://github.com/aioscout/aioscout-desktop/blob/main/src/renderer/main.js): `src/renderer/main.js`
- [Preload bridge](https://github.com/aioscout/aioscout-desktop/blob/main/src/preload/index.ts): `src/preload/index.ts`
- [Embedded views](https://github.com/aioscout/aioscout-desktop/blob/main/src/main/windowManager.ts): `src/main/windowManager.ts`

### Electron orchestration

- [App coordinator](https://github.com/aioscout/aioscout-desktop/blob/main/src/main/index.ts): `src/main/index.ts`
- [IPC handlers](https://github.com/aioscout/aioscout-desktop/blob/main/src/main/ipc.ts): `src/main/ipc.ts`
- [App settings](https://github.com/aioscout/aioscout-desktop/blob/main/src/main/settings.ts): `src/main/settings.ts`
- [Runtime paths](https://github.com/aioscout/aioscout-desktop/blob/main/src/main/paths.ts): `src/main/paths.ts`
- [Shared IPC contract](https://github.com/aioscout/aioscout-desktop/blob/main/src/shared/types.ts): `src/shared/types.ts`

### Backend services

- [Mixly service](https://github.com/aioscout/aioscout-desktop/blob/main/src/main/services/mixly.ts): `src/main/services/mixly.ts`
- [Training service](https://github.com/aioscout/aioscout-desktop/blob/main/src/main/services/training.ts): `src/main/services/training.ts`
- **Mixly block editor**
- **Training backend**

### Model and device workflow

- **Export outbox**
- [Export watcher](https://github.com/aioscout/aioscout-desktop/blob/main/src/main/linkage/exportWatcher.ts): `src/main/linkage/exportWatcher.ts`
- [Model library](https://github.com/aioscout/aioscout-desktop/blob/main/src/main/linkage/modelLibrary.ts): `src/main/linkage/modelLibrary.ts`
- [Arduino toolchain](https://github.com/aioscout/aioscout-desktop/blob/main/src/main/arduinoCli.ts): `src/main/arduinoCli.ts`

### Other components

- **User**
- **AIoScout smart car**

## Connections

- User → Shell UI: navigates
- Shell UI → Preload bridge: invokes IPC
- Preload bridge → IPC handlers: forwards requests
- IPC handlers → App coordinator: dispatches actions
- App coordinator → App settings: loads settings
- App coordinator → Runtime paths: resolves paths
- App coordinator → Mixly service: starts service
- App coordinator → Training service: starts service
- App coordinator → Embedded views: selects page
- Mixly service → Mixly block editor: forks server
- Training service → Training backend: spawns backend
- Mixly block editor → Embedded views: serves editor
- Training backend → Embedded views: serves training UI
- Training backend → Export outbox: writes exports
- Export watcher → Export outbox: watches files
- App coordinator → Export watcher: starts watcher
- Export watcher → Model library: imports models
- IPC handlers → Model library: manages models
- Mixly block editor → Model library: reads models
- App coordinator → Arduino toolchain: seeds toolchain
- Mixly block editor → Arduino toolchain: uses CLI
- Arduino toolchain → AIoScout smart car: uploads firmware
- IPC handlers → Shared IPC contract: uses channel definitions
- Preload bridge → Shared IPC contract: uses channel definitions
- Model library → Shell UI: notifies changes
