Synvro.Modulus.Cli 2.0.0

dotnet tool install --global Synvro.Modulus.Cli --version 2.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local Synvro.Modulus.Cli --version 2.0.0
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=Synvro.Modulus.Cli&version=2.0.0
                    
nuke :add-package Synvro.Modulus.Cli --version 2.0.0
                    

Modulus Framework

<p align="center"> <img src="logo.png" alt="Modulus logo" width="160" /> </p>

An enterprise-grade modular monolith framework for .NET 8 and .NET 10, built with an explicit-registration module system, CLI scaffolding, a transactional outbox/inbox, and first-class multi-tenancy.

Overview

Modulus is designed for teams who need the architectural rigour of ABP or eShop without the heavyweight abstractions. It provides proven building blocks that compose cleanly — pick only what your application needs. The framework ships as 44 focused NuGet packages (published as Synvro.Modulus.*; the analyzer is packed inside Synvro.Modulus.AspNetCore) plus a dotnet tool CLI for scaffolding complete solutions, modules, and CRUD code.

Solution layout

src/                    45 projects across:
  core/          Modulus.Core (abstractions+impl merged), Modulus.AspNetCore
  analyzers/     Modulus.Analyzers (Roslyn MOD0001/MOD0002/MOD0003; packed in Modulus.AspNetCore)
  data/          Modulus.Data.Abstractions, Modulus.EntityFrameworkCore,
                 EF Core providers (SqlServer, PostgreSQL, MySQL, SQLite), Data.MongoDB
  identity/      Modulus.Identity (OpenIddict server, 6 IdP adapters, EF Core mapping,
                 SAML, LDAP, passkeys, sessions, SCIM 2.0)
  messaging/     Modulus.Events, Modulus.Mediator, Modulus.Inbox (+ MongoDB),
                 Modulus.Outbox, Modulus.Outbox.Abstractions (kept: circular-dep seam),
                 Modulus.Outbox.Management, Modulus.Outbox.MongoDB, EventBus.RabbitMQ,
                 EventBus.Kafka, Modulus.Sagas (Rebus), Modulus.Webhooks (signed outgoing
                 webhooks), Modulus.Realtime (SSE / SignalR) + Realtime.Redis
  platform/      Modulus.Platform (MultiTenancy, Authorization, BackgroundJobs, Caching,
                 Storage, SignalR, Networking), opt-in providers: Storage.S3,
                 Storage.AzureBlobs, Caching.Redis, SignalR.Backplane,
                 MultiTenancy.EntityFrameworkCore, Authorization.EntityFrameworkCore,
                 Authorization.Management, AuditLogging.EntityFrameworkCore,
                 AspNetCore.Redis (idempotency store), BackgroundJobs.Quartz,
                 Bff (per-client backends on YARP), Grpc,
                 GraphQL (GraphQL.NET)
  ai/            Modulus.AI.Connector (external AI platform connector), .EntityFrameworkCore
                 (change journal), .Testing (conformance kit)
  observability/ Modulus.Observability (Diagnostics + OpenTelemetry merged)
  testing/       Modulus.Testing (WebApplicationFactory harness), Modulus.Testing.Architecture
  cli/           Modulus.Cli (Spectre.Console.Cli scaffolding tool)
tests/                  42 projects
  unit/          xUnit + NSubstitute + FluentAssertions (Category=Unit)
  integration/   xUnit + Testcontainers (Docker required; Category=Integration)
  benchmarks/    BenchmarkDotNet (Modulus.Benchmarks)

Getting started

Prerequisites

  • .NET SDK 10.0.109 or newer (dotnet --version)
  • Docker (only for the Testcontainers-based integration tests)

Create a new application

The Synvro.Modulus.* packages are published to nuget.org on release (tags v* via .github/workflows/release.yml, requires NUGET_API_KEY), but you can also use a local feed built from this repo. Pack the local feed first, then install the CLI tool and scaffold a complete modular-monolith solution:

# Pack and install the CLI tool
dotnet pack modulus.slnx -c Release -o ./nupkg
dotnet tool install -g --add-source ./nupkg Synvro.Modulus.Cli

# Generate a new application (SQLite by default) and run it.
# --package-source wires the generated NuGet.config's modulus-local source
# (with Synvro.Modulus.* source mapping) to your local feed; omit it once the
# framework version you need is on nuget.org.
modulus app MyApp --package-source "<abs-path-to>/nupkg"
cd MyApp
dotnet restore
dotnet run --project src/API/MyApp.Api

CLI commands

The modulus CLI (Spectre.Console.Cli + Scriban) is a dotnet tool that generates complete solutions, modules, commands, queries, and CRUD code:

Command Description
modulus app <name> Creates a modular-monolith solution (Host + Shared kernel + example module + tests)
modulus module <name> Creates a blank business module (five projects)
modulus add-module <name> Adds a module to an existing app + wires Program.cs registration + ProjectReference
modulus generate-crud <Entity> --module M Generates entity, repo, DTOs, command/query handlers, controller
modulus generate-command <Name> --module M Generates a single command + handler
modulus generate-query <Name> --module M Generates a single query + handler
modulus migrate add <Name> Scaffolds an EF Core migration in each module's Infrastructure project
modulus migrate update Applies pending migrations to each module's database

Each generated module uses a Clean-Architecture layout ({App}.Modules.{Module}.{Domain,Application,IntegrationEvents,Infrastructure,Presentation}) with a per-module DbContext, per-module IUnitOfWork, DTOs under Application/Dtos, and integration events in their own IntegrationEvents project.

Templates are embedded Scriban resources under cli/Templates/.

Generating an application

There is no sample application in this repository. Generate a working app with the CLI instead: modulus app MyApp --with-example (see cli/ and website/docs/cli/app.md).

Module system

Modules implement IModule or inherit from ModulusModule and are registered explicitly in Program.cs. AddModulus(configuration, configure) invokes a ModulusBuilder callback where each module is added in order — registration order is authoritative for every lifecycle phase (no dependency-attribute discovery, no startup module).

public sealed class ShopModule : ModulusModule
{
    public override void ConfigureServices(IServiceCollection services, IConfiguration configuration)
    {
        // Register module-specific services
    }
}
// Program.cs
builder.Services.AddModulus(builder.Configuration, modules => modules
    .AddModule<IdentityModule>()
    .AddModule<DataModule>()
    .AddModule<ShopModule>());

Features

  • Modular architecture — explicit-registration module system where AddModulus(configuration, modules => modules.AddModule<T>()...) wires the app and registration order drives every lifecycle phase.
  • CQRS mediator — ICommand<TResult> / IQuery<TResult> with open-generic pipeline behaviors (validation, logging, transaction). No MediatR dependency.
  • Domain-Driven Design — AggregateRoot<TId> with domain-event collection, ValueObject base, specifications, auditing interfaces.
  • Transactional outbox — domain events implementing IIntegrationEvent are enqueued to the outbox within the same DB transaction via ModuleDbContext.SaveChangesAsync. A background OutboxProcessor claims rows atomically, retries with exponential backoff, and dead-letters after max retries.
  • Inbox dedup — idempotent message processing. All IIntegrationEventHandler<T> registrations are wrapped with an atomic claim-by-EventId decorator (EF Core EfInboxStore or MongoDB MongoInboxStore) so redeliveries don't double-execute.
  • Multi-tenancy — ICurrentTenant backed by AsyncLocal<TenantInfo?> (flows into background jobs / consumers), resolution from header/claim/subdomain, per-tenant connection-string resolver, and soft-delete+tenant query filters on ModuleDbContext.
  • OpenIddict identity — password, client-credentials, and refresh-token grants with deny-by-default credential validation, scope allow-listing, and 6 external IdP adapters (Auth0, Authentik, Azure AD, Duende, Keycloak, Okta) that validate bearer tokens locally via OIDC discovery (signature, issuer, lifetime).
  • EF Core providers — SQL Server, PostgreSQL, MySQL, SQLite (EF Core 10), plus MongoDB for document storage.
  • Event bus — RabbitMQ (topic exchange, auto-reconnect) and Kafka (idempotent producer, consumer groups); all implement IModuleBus and integrate with the outbox.
  • Sagas — Rebus-based long-running orchestration.
  • Platform services — permission-based authorization, background job scheduler (in-memory default; replace with Quartz.NET or Hangfire for production multi-replica deployments), caching (memory, tag-based invalidation), file storage (local, S3, Azure Blob), and SignalR hub base classes.
  • API hardening — rate limiting, API versioning, health probes (/health/live, /health/ready), CORS, security headers, idempotency keys, feature flags, secrets guard, at-rest PII encryption, forwarded-headers.
  • Observability — OpenTelemetry tracing wired to the mediator pipeline and module lifecycle; correlation-ID propagation. Add EF Core and HTTP instrumentation via their respective OpenTelemetry packages.

Build

dotnet build modulus.slnx

The solution compiles with 0 errors, 0 warnings (TreatWarningsAsErrors is enabled globally). Central Package Management is used via Directory.Packages.props.

Common commands

Task Command
Build (Debug) dotnet build modulus.slnx
Run all tests dotnet test modulus.slnx
Run unit tests dotnet test modulus.slnx --filter "Category=Unit"
Pack NuGet packages dotnet pack modulus.slnx -c Release
Format check dotnet format modulus.slnx --verify-no-changes

Target frameworks

Every library package targets both .NET 8 (net8.0) and .NET 10 (net10.0), so it works in either runtime:

  • net8.0: .NET 8 LTS (ASP.NET Core and EF Core 8.x)
  • net10.0: .NET 10 (ASP.NET Core and EF Core 10.x)

Exceptions: the Synvro.Modulus.Cli dotnet tool and the code it generates are .NET 10 only. Build from either SDK; SDK 10.0.109 or later is required to build the repository.

License

Apache License 2.0 — see LICENSE.

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.

This package has no dependencies.

Version Downloads Last Updated
2.0.0 4 11/6/2026
1.8.2 100 11/1/2026
1.8.1 91 10/25/2026
1.8.0 93 10/25/2026
1.7.0 106 10/25/2026
1.6.0 102 10/25/2026
1.5.5 102 10/17/2026
1.5.4 105 10/14/2026
1.5.2 91 10/14/2026
1.5.1 92 10/14/2026
1.5.0 102 10/13/2026