# just-code-net/poltertype architecture

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

- Interactive diagram: https://gitdiagram.com/just-code-net/poltertype
- Repository: https://github.com/just-code-net/poltertype

## Overview

PolterType is a cross-platform desktop keyboard-layout auto-corrector. A user types; the app captures key events, buffers a word, detects its intended language/layout, switches the OS layout, and retypes the corrected word. The tray and settings expose configuration and status, while separate subsystems provide suggestions, plugins, sound, and update checks. The graph emphasizes documented product stages and app wiring; several platform backends and settings internals are represented at their directory/module level because their implementations were not sampled.

Main entry points: [`crates/poltertype-app/src/main.rs`](https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-app/src/main.rs) (App Orchestrator), [`crates/poltertype-core/src/engine/switcher/engine.rs`](https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-core/src/engine/switcher/engine.rs) (Word Switcher), [`crates/poltertype-input/src/factory.rs`](https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-input/src/factory.rs) (Keyboard Capture), [`crates/poltertype-detect/src/dictionary_detector.rs`](https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-detect/src/dictionary_detector.rs) (Language Detection)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Desktop App"]
  node_entry["App Orchestrator<br/>[main.rs]"]
  node_tray["Tray Menu<br/>[tray.rs]"]
end

subgraph group_correction["Correction Runtime"]
  node_engine["Word Switcher<br/>[engine.rs]"]
  node_buffer["Word Buffer<br/>[word_buffer.rs]"]
  node_detector["Language Detection"]
  node_ai["Optional AI Detectors<br/>[detector.rs]"]
end

subgraph group_platform["Platform I/O"]
  node_input["Keyboard Capture<br/>[factory.rs]"]
  node_focus["Focus Tracking<br/>[factory.rs]"]
  node_layout["Layout Switching<br/>[factory.rs]"]
end

subgraph group_configuration["Settings &amp; Extensions"]
  node_settingsui["Settings Window<br/>[view.rs]"]
  node_settings["Settings Store<br/>[store.rs]"]
  node_hotkeys["Hotkey Handling<br/>[hotkeys.rs]"]
  node_profiles["Wordlist Profiles<br/>[resolve.rs]"]
  node_plugins["Plugin Runtime<br/>[lifecycle.rs]"]
end

subgraph group_support["User Feedback"]
  node_popup["Suggestions Popup<br/>[renderer.rs]"]
  node_audio["Correction Audio<br/>[worker.rs]"]
  node_updater["Update Checker<br/>[manifest.rs]"]
end

node_user(("Typist"))
node_desktop(("Operating System"))
node_updatehost(("Release Host"))

node_user -->|"types keys"| node_input
node_entry -->|"starts listener"| node_input
node_input -->|"sends key events"| node_engine
node_engine -.->|"tracks word"| node_buffer
node_engine -->|"decides layout"| node_detector
node_detector -.->|"adds optional opinion"| node_ai
node_engine -->|"switches and retypes"| node_layout
node_layout -->|"changes active layout"| node_desktop
node_entry -->|"runs engine"| node_engine
node_entry -->|"builds tray"| node_tray
node_user -->|"opens controls"| node_tray
node_user -->|"configures app"| node_settingsui
node_settingsui -.->|"updates preferences"| node_settings
node_entry -->|"registers hotkeys"| node_hotkeys
node_entry -->|"starts extensions"| node_plugins
node_entry -->|"watches focus profiles"| node_profiles
node_engine -->|"shows suggestions"| node_popup
node_engine -.->|"plays sound themes"| node_audio
node_entry -->|"checks for updates"| node_updater
node_updater -->|"fetches manifest"| node_updatehost

click node_entry "https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-app/src/main.rs"
click node_tray "https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-app/src/tray.rs"
click node_settingsui "https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-app/src/settings_ui/view.rs"
click node_settings "https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-core/src/settings/store.rs"
click node_hotkeys "https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-app/src/hotkeys.rs"
click node_profiles "https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-core/src/wordlist_profiles/resolve.rs"
click node_plugins "https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-app/src/plugins/supervisor/lifecycle.rs"
click node_input "https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-input/src/factory.rs"
click node_focus "https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-input/src/focus/factory.rs"
click node_engine "https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-core/src/engine/switcher/engine.rs"
click node_buffer "https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-core/src/engine/buffer/word_buffer.rs"
click node_detector "https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-detect/src/dictionary_detector.rs"
click node_ai "https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-ai/src/detector.rs"
click node_layout "https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-layout/src/factory.rs"
click node_popup "https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-popup/src/renderer.rs"
click node_audio "https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-core/src/audio/worker.rs"
click node_updater "https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-update/src/manifest.rs"

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_entry,node_tray toneBlue
class node_engine,node_buffer,node_detector,node_ai toneAmber
class node_input,node_focus,node_layout toneMint
class node_settingsui,node_settings,node_hotkeys,node_profiles,node_plugins toneRose
class node_popup,node_audio,node_updater,node_user,node_desktop,node_updatehost toneIndigo
```

## Components

### Desktop App

- [App Orchestrator](https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-app/src/main.rs): `crates/poltertype-app/src/main.rs`
- [Tray Menu](https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-app/src/tray.rs): `crates/poltertype-app/src/tray.rs`

### Correction Runtime

- [Word Switcher](https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-core/src/engine/switcher/engine.rs): `crates/poltertype-core/src/engine/switcher/engine.rs`
- [Word Buffer](https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-core/src/engine/buffer/word_buffer.rs): `crates/poltertype-core/src/engine/buffer/word_buffer.rs`
- [Language Detection](https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-detect/src/dictionary_detector.rs): `crates/poltertype-detect/src/dictionary_detector.rs`
- [Optional AI Detectors](https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-ai/src/detector.rs): `crates/poltertype-ai/src/detector.rs`

### Platform I/O

- [Keyboard Capture](https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-input/src/factory.rs): `crates/poltertype-input/src/factory.rs`
- [Focus Tracking](https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-input/src/focus/factory.rs): `crates/poltertype-input/src/focus/factory.rs`
- [Layout Switching](https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-layout/src/factory.rs): `crates/poltertype-layout/src/factory.rs`

### Settings & Extensions

- [Settings Window](https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-app/src/settings_ui/view.rs): `crates/poltertype-app/src/settings_ui/view.rs`
- [Settings Store](https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-core/src/settings/store.rs): `crates/poltertype-core/src/settings/store.rs`
- [Hotkey Handling](https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-app/src/hotkeys.rs): `crates/poltertype-app/src/hotkeys.rs`
- [Wordlist Profiles](https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-core/src/wordlist_profiles/resolve.rs): `crates/poltertype-core/src/wordlist_profiles/resolve.rs`
- [Plugin Runtime](https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-app/src/plugins/supervisor/lifecycle.rs): `crates/poltertype-app/src/plugins/supervisor/lifecycle.rs`

### User Feedback

- [Suggestions Popup](https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-popup/src/renderer.rs): `crates/poltertype-popup/src/renderer.rs`
- [Correction Audio](https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-core/src/audio/worker.rs): `crates/poltertype-core/src/audio/worker.rs`
- [Update Checker](https://github.com/just-code-net/poltertype/blob/main/crates/poltertype-update/src/manifest.rs): `crates/poltertype-update/src/manifest.rs`

### Other components

- **Typist**
- **Operating System**
- **Release Host**

## Connections

- Typist → Keyboard Capture: types keys (evidence: `README.md`)
- App Orchestrator → Keyboard Capture: starts listener (evidence: `crates/poltertype-app/src/main.rs`)
- Keyboard Capture → Word Switcher: sends key events
- Word Switcher → Word Buffer: tracks word
- Word Switcher → Language Detection: decides layout (evidence: `README.md`)
- Language Detection → Optional AI Detectors: adds optional opinion
- Word Switcher → Layout Switching: switches and retypes (evidence: `README.md`)
- Layout Switching → Operating System: changes active layout (evidence: `README.md`)
- App Orchestrator → Word Switcher: runs engine (evidence: `crates/poltertype-app/src/main.rs`)
- App Orchestrator → Tray Menu: builds tray (evidence: `crates/poltertype-app/src/main.rs`)
- Typist → Tray Menu: opens controls (evidence: `README.md`)
- Typist → Settings Window: configures app (evidence: `README.md`)
- Settings Window → Settings Store: updates preferences
- App Orchestrator → Hotkey Handling: registers hotkeys (evidence: `crates/poltertype-app/src/main.rs`)
- App Orchestrator → Plugin Runtime: starts extensions (evidence: `crates/poltertype-app/src/main.rs`)
- App Orchestrator → Wordlist Profiles: watches focus profiles (evidence: `crates/poltertype-app/src/main.rs`)
- Word Switcher → Suggestions Popup: shows suggestions (evidence: `README.md`)
- Word Switcher → Correction Audio: plays sound themes
- App Orchestrator → Update Checker: checks for updates (evidence: `README.md`)
- Update Checker → Release Host: fetches manifest (evidence: `README.md`)
