How devtoys-app/devtoys works
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: Main.razor App shell · DevToys.UnitTests.csproj Tests · DevToys.Localization.csproj Localization · MefComposer.cs MEF
Components 22
Core
Shared application logic, composition, and services.
- MEF · Assembly discovery, composition, and extension ordering.
src/app/dev/DevToys.Core/Mef/MefComposer.cs - Tool model · Tool instances, view items, and metadata-driven navigation model.
src/app/dev/DevToys.Core/Tools/GuiToolProvider.cs - Smart detect · Input classification and tool recommendation service.
src/app/dev/DevToys.Core/Tools/SmartDetectionService.cs - Settings · Shared settings storage and predefined app settings.
src/app/dev/DevToys.Core/Settings/SettingsProvider.cs - Runtime svc · 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 · 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 · Main Blazor entry, pages, dialogs, and navigation flow.
src/app/dev/DevToys.Blazor/Main.razor - Presenters · Adapters that render DevToys.Api UI abstractions as Blazor controls.
src/app/dev/DevToys.Blazor/Components/UIElements/UIElementPresenter.razor - Components · Reusable Blazor layout, input, feedback, menu, and collection controls.
src/app/dev/DevToys.Blazor/Components/Layout/Dialog/Dialog.razor - Monaco · Rich text and diff editor wrapper plus language/model types.
src/app/dev/DevToys.Blazor/Components/Text/MonacoEditor/MonacoEditor.razor - Built-ins · Default tools grouped by category and their data type detectors.
src/app/dev/DevToys.Blazor/BuiltInTools/Settings/SettingsGuiTool.cs - Ext manager · 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 · Windows shell, native windowing, taskbar integration, and Blazor hosting.
src/app/dev/platforms/desktop/DevToys.Windows/App.xaml.cs - macOS host · macOS shell, AppKit integration, and WKWebView-based Blazor hosting.
src/app/dev/platforms/desktop/DevToys.MacOS/Program.cs - Linux host · Linux shell, GTK/WebKit-style hosting, and desktop service adapters.
src/app/dev/platforms/desktop/DevToys.Linux/Program.cs - Host services · 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 · 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 · View models and navigation state between core and UI.
src/app/dev/DevToys.Business/ViewModels/MainWindowViewModel.cs - Localization · Shared and project-specific resource sets for UI text and cultures.
src/app/dev/DevToys.Localization/DevToys.Localization.csproj - Build · Nuke build, versioning, restore tasks, and repository automation.
src/build/Build.cs - Tests · Unit tests for core logic, detectors, presenters, and extension behavior.
src/app/tests/DevToys.UnitTests/DevToys.UnitTests.csproj - Generators · Source generators for resource helpers and culture helpers.
src/generators/ResxHelperGenerator/CultureHelperGenerator.cs
Connections 32
- 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.