Modus.Host
0.0.1
dotnet tool install --global Modus.Host --version 0.0.1
dotnet new tool-manifest
dotnet tool install --local Modus.Host --version 0.0.1
#tool dotnet:?package=Modus.Host&version=0.0.1
nuke :add-package Modus.Host --version 0.0.1
Modus.Host
Host runtime for the Modus modular monolith framework. Discovers, validates, composes, and activates plugins with failure isolation and deterministic lifecycle management.
Built-in HTTP Surface
Every plugin operation is mapped to POST /api/{pluginId}/{operation} by PluginEndpointMapper. The host also registers OpenAPI through AddOpenApi() and app.MapOpenApi(), which means /openapi/v1.json and Swagger UI are available as soon as the host starts.
Embedded Host Integration
Use AddModusPluginHosting when Modus is embedded inside another application or when you want the host to discover plugin assemblies and wire runtime services for you.
using Microsoft.Extensions.DependencyInjection;
using Modus.Host.Hosting;
var services = new ServiceCollection();
services.AddModusPluginHosting(options =>
{
options.PluginsPath = "plugins";
options.RunOnce = false;
});
The host honors the plugin lifetime declarations exposed by SingletonPlugin<T>, ScopedPlugin<T>, and TransientPlugin<T>. Plugin contract interfaces that extend IPluginContract are registered automatically, and RegisterPluginServices(IServiceCollection services) remains available for any extra plugin-only dependencies.
Installation
dotnet tool install -g Modus.Host
Usage
Point the host at a folder containing compiled plugin assemblies:
modus plugins/
The host will:
- Discover — scan the folder for assemblies that expose plugin descriptors
- Validate — enforce contract requirements and capability constraints
- Register — wire plugin dependencies into the DI container
- Activate — start plugins in dependency order
- Isolate — contain faults so a failing plugin does not halt healthy ones
Plugin authoring
Install Modus.Core in your plugin project and implement the plugin contracts:
dotnet add package Modus.Core
Drop the compiled plugin assembly into the plugins folder and restart the host (or trigger a hot-load if enabled).
Architecture
plugins/
├── MyPlugin.dll ← implements Modus.Core contracts
└── AnotherPlugin.dll
modus plugins/ ← discovers, validates, activates
- Plugins communicate through domain events, never by direct assembly reference
- The host is the only composition root — plugins never reach into host internals
- Scheduled and timer-driven plugins are supported via
IPluginScheduledEvents.RegisterSchedules(IPluginScheduler scheduler)and host-visible diagnostics
The host runtime composes dependencies, orchestrates lifecycle stages, and enforces boundary validation before activation.
Lifecycle and Runtime Extension Points
Registration and composition flow
AddModusPluginHostinginitializes hosting options and runtime composition.AddPluginHostingCoreregisters portability contracts and host-core defaults.AddDiscoveredPluginswires plugin registrars and capability contracts into DI.AddModusPluginHostingRuntimeadds discovery, validation, watcher, and host runner services.
Runtime lifecycle hooks
IPluginLifecycle hooks are executed as deterministic runtime stages:
Load(PluginLoadContext)Start(PluginStartContext)Stop(PluginStopContext)Unload(PluginUnloadContext)
REST endpoint mapping and OpenAPI
PluginEndpointMapper joins plugin contract metadata and supported operations to register HTTP endpoints for the live host. Every declared operation is exposed as POST /api/{pluginId}/{operation}, and the same pipeline makes the generated OpenAPI document visible at /openapi/v1.json with Swagger UI at /swagger.
Runtime resolution helpers
HostRunner.StartAsyncstarts runtime scanning and watcher registration for the configured plugins path.TryResolvePluginsByContractInterfaceNameresolves active plugin instances by contract interface full name.TryResolvePluginByTypeNameresolves a plugin instance by concrete type full name.
Diagnostics and Troubleshooting
Use runtime stages as the primary troubleshooting spine:
- discovery: verify plugin path and descriptor onboarding inputs
- validation: inspect contract, capability, and operation catalog failures
- activate: inspect lifecycle hook failures for the plugin identifier in error output
Failure isolation is intentional: one plugin fault should not terminate healthy plugin activation. Prefer fixing or disabling only the failing plugin and re-running host startup validation.
Related packages
- Modus.Core — contracts and extension points for plugin authors
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
This package has no dependencies.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.0.1 | 96 | 5/23/2026 |