# devtoys-app/devtoys architecture

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

- Interactive diagram: https://gitdiagram.com/devtoys-app/devtoys
- Repository: https://github.com/devtoys-app/devtoys

## Overview

1. **Overall shape**
   - DevToys is a multi-project .NET desktop application with a plugin-oriented architecture.
   - The center of the system is a shared tool model plus a Blazor-based UI, hosted by platform-specific desktop shells for Windows, macOS, and Linux.
   - The repository also contains a command-line entry point, a shared public API for extensions, localization resources, build automation, and tests.

2. **Core application layer**
   - `DevToys.Core` is the main non-UI application layer.
   - It owns composition and discovery (`MefComposer`, `MefProvider`), tool catalog modeling, extension ordering, settings abstraction, logging, version checking, web client access, and smart-detection logic.
   - It defines the internal “app contract” used by both the UI and the platform hosts.

3. **Public extension API**
   - `DevToys.Api` is the boundary exposed to tool authors and extension packages.
   - It defines interfaces and contracts for tools, GUI components, CLI tools, settings, clipboard, file storage, font access, theme listening, smart detection, and localization.
   - This assembly is intentionally broader than the core app internals; it is the compatibility surface for third-party tools.

4. **UI subsystem**
   - `DevToys.Blazor` implements the user interface in Blazor, but it is not a web app; it is rendered inside native desktop webview hosts.
   - It contains the app shell (`Main.razor`), main pages, dialogs, navigation, and a large set of reusable UI components.
   - The UI layer also includes “presenters” that adapt `DevToys.Api.Tool.GUI` abstractions into concrete Blazor controls.

5. **Built-in tools and detectors**
   - Inside `DevToys.Blazor`, the built-in tools are grouped by category such as converters, encoders/decoders, formatters, generators, graphics, testers, and text utilities.
   - Data type detectors live alongside these tools and feed the Smart Detection feature.
   - This is where the app’s default capabilities are implemented, while the core layer handles discovery and selection.

6. **Smart Detection flow**
   - Clipboard or user-supplied input enters the platform abstraction layer, then reaches the core smart-detection service.
   - Detectors analyze the payload and classify it as text, JSON, XML, Base64, files, images, dates, and similar types.
   - The result is used to select or recommend a tool page in the UI rather than forcing the user to browse manually.

7. **Platform host boundary**
   - Each desktop platform project provides the native shell and the implementations of shared system services: clipboard, file storage, font provider, settings storage, theme listener, and window service.
   - These projects are the bridge between OS-native APIs and the shared application code.
   - They also host the Blazor UI through a platform-specific `BlazorWebView` implementation.

8. **Windows, macOS, and Linux differences**
   - The Windows project includes native window chrome, overlay handling, taskbar/jump-list support, efficiency mode hooks, and Windows-specific composition helpers.
   - The macOS project includes AppKit integration, window/menu handling, and WKWebView-based hosting.
   - The Linux project provides GTK/WebKit-style hosting and platform-specific window and input integration.
   - The shared app behavior is the same; only these host adapters differ.

9. **Command-line subsystem**
   - `platforms/desktop/DevToys.CLI` is a separate executable that maps command-line options to command-line tool implementations.
   - It uses the same underlying tool contracts, but drives them without the GUI.
   - This gives the repository two entry modes: interactive desktop UI and scriptable CLI.

10. **Business/presentation models**
   - `DevToys.Business` sits between the core app and the UI shell.
   - It contains view models for the main window, tool group pages, and tool pages, plus a command-line launcher service.
   - This layer is where app-navigation state is translated into UI-facing models.

11. **Extension and package loading**
   - Extension support is built around MEF-style composition and metadata scanning.
   - Tool groups, tools, data type detectors, and language services are discovered from assemblies and ordered into the navigation model.
   - There is also an extension installation manager in the Blazor layer, which implies package validation and installation as part of the app’s extension boundary.

12. **Localization architecture**
   - `DevToys.Localization` holds shared resource files for dialogs, window chrome, text boxes, toggle switches, and other shared UI strings.
   - Many projects also carry their own localized resource sets for platform-specific UI.
   - The generated resource helpers and culture generators show that localization is treated as a first-class cross-cutting concern.

13. **Custom Blazor component system**
   - The UI has its own component library for layout, text, menus, lists, grids, popovers, dialogs, and feedback elements.
   - Many components have small JS/TS companions for DOM behavior, focus trapping, scrolling, resizing, or editor interop.
   - This component system is the main rendering boundary between the UI model and the browser engine embedded in the desktop shell.

14. **Monaco editor integration**
   - The text-editor experience is built around a substantial Monaco editor wrapper and a large set of editor/language model types.
   - This subsystem supports code-like editing, diffing, syntax-aware behavior, and language services within the Blazor UI.
   - It is one of the biggest internal integrations because many tools depend on it.

15. **Build, versioning, and test infrastructure**
   - Root-level Nuke build scripts, version-updater tasks, restore tasks, and generator projects handle repository automation.
   - Tests cover core utilities, MEF composition, detectors, UI helpers, and extension installation behavior.
   - This indicates the codebase is organized as a product platform with strong emphasis on composability, localization, and cross-platform desktop hosting.

Main entry points: [`src/app/dev/DevToys.Blazor/Main.razor`](https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Blazor/Main.razor) (App shell), [`src/app/tests/DevToys.UnitTests/DevToys.UnitTests.csproj`](https://github.com/devtoys-app/devtoys/blob/main/src/app/tests/DevToys.UnitTests/DevToys.UnitTests.csproj) (Tests), [`src/app/dev/DevToys.Localization/DevToys.Localization.csproj`](https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Localization/DevToys.Localization.csproj) (Localization), [`src/app/dev/DevToys.Core/Mef/MefComposer.cs`](https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Core/Mef/MefComposer.cs) (MEF)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_grp_core["Core"]
  node_n_core_mef["MEF<br/>composition<br/>[MefComposer.cs]"]
  node_n_core_tools["Tool model<br/>catalog<br/>[GuiToolProvider.cs]"]
  node_n_core_detection["Smart detect"]
  node_n_core_settings["Settings<br/>state"]
  node_n_core_runtime["Runtime svc<br/>infrastructure<br/>[VersionService.cs]"]
end

subgraph group_grp_api["API"]
  node_n_api_contracts["Extension API<br/>contracts<br/>[DevToys.Api.csproj]"]
end

subgraph group_grp_ui["UI"]
  node_n_ui_shell["App shell<br/>[Main.razor]"]
  node_n_ui_presenters["Presenters<br/>adapter"]
  node_n_ui_components["Components<br/>component library<br/>[Dialog.razor]"]
  node_n_ui_monaco["Monaco<br/>editor integration<br/>[MonacoEditor.razor]"]
  node_n_ui_builtins["Built-ins<br/>tools<br/>[SettingsGuiTool.cs]"]
  node_n_ui_extensions["Ext manager<br/>extension UX"]
end

subgraph group_grp_platforms["Platforms"]
  node_n_platform_windows["Windows host<br/>desktop host<br/>[App.xaml.cs]"]
  node_n_platform_macos["macOS host<br/>desktop host<br/>[Program.cs]"]
  node_n_platform_linux["Linux host<br/>desktop host<br/>[Program.cs]"]
  node_n_platform_services["Host services<br/>os adapters<br/>[WindowService.cs]"]
end

subgraph group_grp_cli["CLI"]
  node_n_cli_entry["CLI entry<br/>console app<br/>[Program.cs]"]
end

subgraph group_grp_support["Support"]
  node_n_business["Business<br/>presentation"]
  node_n_localization["Localization<br/>resources"]
  node_n_build["Build<br/>automation<br/>[Build.cs]"]
  node_n_tests["Tests<br/>test suite"]
  node_n_generators["Generators<br/>codegen"]
end

node_n_api_contracts -->|"contracts for composition"| node_n_core_mef
node_n_api_contracts -->|"UI contracts"| node_n_ui_presenters
node_n_api_contracts -->|"CLI contracts"| node_n_cli_entry
node_n_core_mef -->|"discovers"| node_n_core_tools
node_n_core_tools -->|"selects tools"| node_n_core_detection
node_n_core_settings -->|"shares state"| node_n_core_runtime
node_n_core_runtime -->|"uses host services"| node_n_platform_services
node_n_business -->|"drives navigation"| node_n_ui_shell
node_n_business -->|"binds catalog"| node_n_core_tools
node_n_ui_shell -->|"renders"| node_n_ui_presenters
node_n_ui_presenters -->|"composes controls"| node_n_ui_components
node_n_ui_components -->|"embeds editor"| node_n_ui_monaco
node_n_ui_builtins -->|"uses editor"| node_n_ui_monaco
node_n_ui_builtins -->|"feeds detectors"| node_n_core_detection
node_n_ui_extensions -->|"installs extensions"| node_n_core_mef
node_n_platform_windows -->|"implements"| node_n_platform_services
node_n_platform_macos -->|"implements"| node_n_platform_services
node_n_platform_linux -->|"implements"| node_n_platform_services
node_n_platform_windows -->|"hosts UI"| node_n_ui_shell
node_n_platform_macos -->|"hosts UI"| node_n_ui_shell
node_n_platform_linux -->|"hosts UI"| node_n_ui_shell
node_n_cli_entry -->|"runs tools"| node_n_core_tools
node_n_build -->|"invokes"| node_n_generators
node_n_build -->|"verifies"| node_n_tests
node_n_localization -->|"localizes UI"| node_n_ui_shell
node_n_localization -->|"localizes host"| node_n_platform_windows
node_n_localization -->|"localizes host"| node_n_platform_macos
node_n_localization -->|"localizes host"| node_n_platform_linux
node_n_tests -->|"covers"| node_n_core_mef
node_n_tests -->|"covers"| node_n_core_detection
node_n_tests -->|"covers"| node_n_ui_components
node_n_tests -->|"covers"| node_n_ui_extensions

click node_n_core_mef "https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Core/Mef/MefComposer.cs"
click node_n_core_tools "https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Core/Tools/GuiToolProvider.cs"
click node_n_core_detection "https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Core/Tools/SmartDetectionService.cs"
click node_n_core_settings "https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Core/Settings/SettingsProvider.cs"
click node_n_core_runtime "https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Core/Version/VersionService.cs"
click node_n_api_contracts "https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Api/DevToys.Api.csproj"
click node_n_ui_shell "https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Blazor/Main.razor"
click node_n_ui_presenters "https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Blazor/Components/UIElements/UIElementPresenter.razor"
click node_n_ui_components "https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Blazor/Components/Layout/Dialog/Dialog.razor"
click node_n_ui_monaco "https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Blazor/Components/Text/MonacoEditor/MonacoEditor.razor"
click node_n_ui_builtins "https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Blazor/BuiltInTools/Settings/SettingsGuiTool.cs"
click node_n_ui_extensions "https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Blazor/BuiltInTools/ExtensionsManager/ExtensionInstallationManager.cs"
click node_n_platform_windows "https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/platforms/desktop/DevToys.Windows/App.xaml.cs"
click node_n_platform_macos "https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/platforms/desktop/DevToys.MacOS/Program.cs"
click node_n_platform_linux "https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/platforms/desktop/DevToys.Linux/Program.cs"
click node_n_platform_services "https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/platforms/desktop/DevToys.Windows/Core/WindowService.cs"
click node_n_cli_entry "https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/platforms/desktop/DevToys.CLI/Program.cs"
click node_n_business "https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Business/ViewModels/MainWindowViewModel.cs"
click node_n_localization "https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Localization/DevToys.Localization.csproj"
click node_n_build "https://github.com/devtoys-app/devtoys/blob/main/src/build/Build.cs"
click node_n_tests "https://github.com/devtoys-app/devtoys/blob/main/src/app/tests/DevToys.UnitTests/DevToys.UnitTests.csproj"
click node_n_generators "https://github.com/devtoys-app/devtoys/blob/main/src/generators/ResxHelperGenerator/CultureHelperGenerator.cs"

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_n_core_mef,node_n_core_tools,node_n_core_detection,node_n_core_settings,node_n_core_runtime toneBlue
class node_n_api_contracts toneAmber
class node_n_ui_shell,node_n_ui_presenters,node_n_ui_components,node_n_ui_monaco,node_n_ui_builtins,node_n_ui_extensions toneMint
class node_n_platform_windows,node_n_platform_macos,node_n_platform_linux,node_n_platform_services toneRose
class node_n_cli_entry toneIndigo
class node_n_business,node_n_localization,node_n_build,node_n_tests,node_n_generators toneTeal
```

## Components

### Core

Shared application logic, composition, and services.

- [MEF](https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Core/Mef/MefComposer.cs): composition · Assembly discovery, composition, and extension ordering. · `src/app/dev/DevToys.Core/Mef/MefComposer.cs`
- [Tool model](https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Core/Tools/GuiToolProvider.cs): catalog · Tool instances, view items, and metadata-driven navigation model. · `src/app/dev/DevToys.Core/Tools/GuiToolProvider.cs`
- [Smart detect](https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Core/Tools/SmartDetectionService.cs): service · Input classification and tool recommendation service. · `src/app/dev/DevToys.Core/Tools/SmartDetectionService.cs`
- [Settings](https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Core/Settings/SettingsProvider.cs): state · Shared settings storage and predefined app settings. · `src/app/dev/DevToys.Core/Settings/SettingsProvider.cs`
- [Runtime svc](https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Core/Version/VersionService.cs): infrastructure · Logging, web client access, version checks, file helpers, and hot reload support. · `src/app/dev/DevToys.Core/Version/VersionService.cs`

### API

Public extension contracts and shared tool interfaces.

- [Extension API](https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Api/DevToys.Api.csproj): contracts · Public interfaces for GUI tools, CLI tools, settings, clipboard, storage, theme, fonts, and detectors. · `src/app/dev/DevToys.Api/DevToys.Api.csproj`

### UI

Blazor shell, built-in tools, and reusable components.

- [App shell](https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Blazor/Main.razor): shell · Main Blazor entry, pages, dialogs, and navigation flow. · `src/app/dev/DevToys.Blazor/Main.razor`
- [Presenters](https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Blazor/Components/UIElements/UIElementPresenter.razor): adapter · Adapters that render DevToys.Api UI abstractions as Blazor controls. · `src/app/dev/DevToys.Blazor/Components/UIElements/UIElementPresenter.razor`
- [Components](https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Blazor/Components/Layout/Dialog/Dialog.razor): component library · Reusable Blazor layout, input, feedback, menu, and collection controls. · `src/app/dev/DevToys.Blazor/Components/Layout/Dialog/Dialog.razor`
- [Monaco](https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Blazor/Components/Text/MonacoEditor/MonacoEditor.razor): editor integration · Rich text and diff editor wrapper plus language/model types. · `src/app/dev/DevToys.Blazor/Components/Text/MonacoEditor/MonacoEditor.razor`
- [Built-ins](https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Blazor/BuiltInTools/Settings/SettingsGuiTool.cs): tools · Default tools grouped by category and their data type detectors. · `src/app/dev/DevToys.Blazor/BuiltInTools/Settings/SettingsGuiTool.cs`
- [Ext manager](https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Blazor/BuiltInTools/ExtensionsManager/ExtensionInstallationManager.cs): extension UX · Extension installation and validation experience in the UI layer. · `src/app/dev/DevToys.Blazor/BuiltInTools/ExtensionsManager/ExtensionInstallationManager.cs`

### Platforms

Desktop host shells and OS-specific service adapters.

- [Windows host](https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/platforms/desktop/DevToys.Windows/App.xaml.cs): desktop host · Windows shell, native windowing, taskbar integration, and Blazor hosting. · `src/app/dev/platforms/desktop/DevToys.Windows/App.xaml.cs`
- [macOS host](https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/platforms/desktop/DevToys.MacOS/Program.cs): desktop host · macOS shell, AppKit integration, and WKWebView-based Blazor hosting. · `src/app/dev/platforms/desktop/DevToys.MacOS/Program.cs`
- [Linux host](https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/platforms/desktop/DevToys.Linux/Program.cs): desktop host · Linux shell, GTK/WebKit-style hosting, and desktop service adapters. · `src/app/dev/platforms/desktop/DevToys.Linux/Program.cs`
- [Host services](https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/platforms/desktop/DevToys.Windows/Core/WindowService.cs): os adapters · Clipboard, file storage, font provider, settings storage, theme, and window services. · `src/app/dev/platforms/desktop/DevToys.Windows/Core/WindowService.cs`

### CLI

Command-line entry point and option-to-tool mapping.

- [CLI entry](https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/platforms/desktop/DevToys.CLI/Program.cs): console app · Command-line executable and option parsing to tool invocation. · `src/app/dev/platforms/desktop/DevToys.CLI/Program.cs`

### Support

Localization, build automation, generators, and tests.

- [Business](https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Business/ViewModels/MainWindowViewModel.cs): presentation · View models and navigation state between core and UI. · `src/app/dev/DevToys.Business/ViewModels/MainWindowViewModel.cs`
- [Localization](https://github.com/devtoys-app/devtoys/blob/main/src/app/dev/DevToys.Localization/DevToys.Localization.csproj): resources · Shared and project-specific resource sets for UI text and cultures. · `src/app/dev/DevToys.Localization/DevToys.Localization.csproj`
- [Build](https://github.com/devtoys-app/devtoys/blob/main/src/build/Build.cs): automation · Nuke build, versioning, restore tasks, and repository automation. · `src/build/Build.cs`
- [Tests](https://github.com/devtoys-app/devtoys/blob/main/src/app/tests/DevToys.UnitTests/DevToys.UnitTests.csproj): test suite · Unit tests for core logic, detectors, presenters, and extension behavior. · `src/app/tests/DevToys.UnitTests/DevToys.UnitTests.csproj`
- [Generators](https://github.com/devtoys-app/devtoys/blob/main/src/generators/ResxHelperGenerator/CultureHelperGenerator.cs): codegen · Source generators for resource helpers and culture helpers. · `src/generators/ResxHelperGenerator/CultureHelperGenerator.cs`

## Connections

- Extension API → MEF: contracts for composition · Core composes tools and extensions using the public API contracts.
- Extension API → Presenters: UI contracts · Presenters adapt the public GUI abstractions into Blazor controls.
- Extension API → CLI entry: CLI contracts · The CLI drives command-line tools through shared tool interfaces.
- MEF → Tool model: discovers · Composition feeds the tool catalog and navigation model.
- Tool model → Smart detect: selects tools · Tool metadata and smart detection work together to recommend pages.
- Settings → Runtime svc: shares state · Settings, logging, and runtime services support core application behavior.
- Runtime svc → Host services: uses host services · Core services depend on platform implementations for OS integration.
- Business → App shell: drives navigation · View models shape the shell and page state presented in Blazor.
- Business → Tool model: binds catalog · Navigation view models are built from the shared tool catalog.
- App shell → Presenters: renders · The app shell hosts presenter-backed tool UI.
- Presenters → Components: composes controls · Presenters are built from the reusable Blazor component library.
- Components → Monaco: embeds editor · Text-oriented controls rely on the Monaco editor subsystem.
- Built-ins → Monaco: uses editor · Many built-in tools depend on the rich editor integration.
- Built-ins → Smart detect: feeds detectors · Built-in detectors supply smart-detection classifications.
- Ext manager → MEF: installs extensions · Extension management relies on composition and metadata scanning.
- Windows host → Host services: implements · Windows provides the shared clipboard, storage, theme, and window services.
- macOS host → Host services: implements · macOS provides the shared clipboard, storage, theme, and window services.
- Linux host → Host services: implements · Linux provides the shared clipboard, storage, theme, and window services.
- Windows host → App shell: hosts UI · Windows hosts the Blazor app inside a native desktop shell.
- macOS host → App shell: hosts UI · macOS hosts the Blazor app inside a native desktop shell.
- Linux host → App shell: hosts UI · Linux hosts the Blazor app inside a native desktop shell.
- CLI entry → Tool model: runs tools · The command-line entry invokes the same underlying tool model.
- Build → Generators: invokes · Build automation includes source generation and versioning support.
- Build → Tests: verifies · The build and CI pipeline run the test suite.
- Localization → App shell: localizes UI · Shared resources provide text for dialogs, pages, and controls.
- Localization → Windows host: localizes host · Platform projects carry their own localized resource sets.
- Localization → macOS host: localizes host · Platform projects carry their own localized resource sets.
- Localization → Linux host: localizes host · Platform projects carry their own localized resource sets.
- Tests → MEF: covers · Tests validate composition and ordering behavior.
- Tests → Smart detect: covers · Tests validate smart detection classification.
- Tests → Components: covers · Tests validate key Blazor component behavior.
- Tests → Ext manager: covers · Tests validate extension installation behavior.
