Modrich.Modularity 0.1.0

dotnet add package Modrich.Modularity --version 0.1.0
                    
NuGet\Install-Package Modrich.Modularity -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Modrich.Modularity" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Modrich.Modularity" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Modrich.Modularity" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Modrich.Modularity --version 0.1.0
                    
#r "nuget: Modrich.Modularity, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Modrich.Modularity@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Modrich.Modularity&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Modrich.Modularity&version=0.1.0
                    
Install as a Cake Tool

Modrich.Modularity

Module discovery and DI registration engine for the Modrich modular foundation for .NET 10. This is the package the host references — modules themselves should depend on Modrich.Abstractions (or one of the SDK meta-packages).

What's in the box

  • ModuleAssemblyLocator.Discover() — scans DependencyContext.Default and returns every assembly carrying [assembly: ModuleAssembly]. Uses the deps file (not GetReferencedAssemblies) so project references still surface even when the compiler strips unused metadata refs.
  • ModuleAssemblyCatalog — read-only list of discovered assemblies (useful for MVC: AddApplicationPart(...), EF: ApplyConfigurationsFromAssembly(...)).
  • ModuleExtensionsIServiceCollection/WebApplication/IEndpointRouteBuilder extensions:
    • RegisterApiModules(configuration, onRegistered?)
    • RegisterAppModules(configuration, apiBaseUrl?, onRegistered?)
    • RegisterModules(configuration, apiBaseUrl?, onApiRegistered?, onAppRegistered?) — unified host (API + UI in one process)
    • ConfigureModulePipelines(app) — invokes IAppModule.ConfigureAppPipeline
    • MapModuleEndpoints(endpoints) — invokes IAppModule.MapAppEndpoints
    • GetModuleAssemblies<TModule>() — assemblies that contain a concrete implementation of TModule
    • ReadModuleConfig(configuration) — strongly-typed view of the Modules:* config section
  • ModuleRegistryIModuleRegistry implementation.

Install

dotnet add package Modrich.Modularity

Usage — API-only host

using Modrich.Modules;

var builder = WebApplication.CreateBuilder(args);

builder.Services.RegisterApiModules(builder.Configuration);

var app = builder.Build();
app.MapControllers();
app.Run();

RegisterApiModules:

  1. Discovers every [assembly: ModuleAssembly] assembly and instantiates each IApiModule.
  2. Calls RegisterApiDependencies(services, configuration) on each.
  3. Aggregates IModule.Permissions + implicit Module.{Name}.Access into a PermissionCatalog.
  4. Registers PermissionAuthorizationPolicyProvider so [Authorize(Policy = "...")] resolves dynamically.
  5. Registers an IModuleRegistry snapshot.

Usage — App (UI) host

builder.Services.RegisterAppModules(builder.Configuration, apiBaseUrl: "https://api.acme.com");

var app = builder.Build();
app.ConfigureModulePipelines();   // before UseAuthentication
app.UseAuthentication();
app.UseAuthorization();
app.MapModuleEndpoints();
app.Run();

Usage — unified host (API + UI in one process)

builder.Services.RegisterModules(builder.Configuration, apiBaseUrl: "https://localhost");

A module whose Modules:<Name>:ApiBaseUrl is set in configuration is treated as externally hosted: only its UI-side dependencies are wired (Refit clients targeting the external URL); its API-side DI is skipped. Permissions are still aggregated either way.

appsettings.json:

{
  "Modules": {
    "Orders":   { "ApiBaseUrl": "https://orders.acme.com" },
    "Products": { }
  }
}

Usage — MVC controllers and EF configs from modules

var catalog = new ModuleAssemblyCatalog { Assemblies = ModuleAssemblyLocator.Discover() };

var mvc = builder.Services.AddControllers();
foreach (var asm in catalog.Assemblies)
    mvc.AddApplicationPart(asm);

builder.Services.AddDbContext<AppDbContext>((sp, opt) =>
    opt.UseSqlServer(connectionString,
        b => b.MigrationsAssembly(typeof(AppDbContext).Assembly.GetName().Name)));

Inside an EF OnModelCreating:

foreach (var asm in moduleAssemblyCatalog.Assemblies)
    modelBuilder.ApplyConfigurationsFromAssembly(asm);
  • Modrich.Abstractions — module contracts.
  • Gatekeep.Authorization / Gatekeep.Authorization.Abstractions — the catalog + policy provider this package registers.
  • Modrich.Navigation.Abstractions — picked up by App modules.
  • Modrich.Persistence — pair with this to run module migrations + seeders.

License

MIT.

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (2)

Showing the top 2 NuGet packages that depend on Modrich.Modularity:

Package Downloads
Modrich.Sdk.Web

Package Description

Modrich.Persistence

Package Description

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.0 122 5/23/2026
0.0.1 105 5/23/2026