A collection of reusable .NET libraries providing common infrastructure for building distributed, observable, and resilient microservices. Each module is published as an independent NuGet package and can be adopted incrementally.
| Package | Description |
|---|---|
| SOFTURE.Common.Authentication | JWT Bearer authentication setup and configuration |
| SOFTURE.Common.CQRS | CQRS middleware and validation behaviors for MediatR pipelines |
| SOFTURE.Common.Correlation | Request correlation ID tracking for distributed tracing |
| SOFTURE.Common.HealthCheck | Health check framework with standardized response format |
| SOFTURE.Common.Logging | Structured logging with Serilog and Seq integration |
| SOFTURE.Common.Observability | OpenTelemetry tracing and metrics (Prometheus, OTLP) |
| SOFTURE.Common.Resilience | HTTP resilience policies — retry, circuit breaker, hedging, fallback |
| SOFTURE.Common.StronglyTypedIdentifiers | Strongly-typed ID abstractions with EF Core and FastEndpoints support |
| SOFTURE.MessageBroker.Rabbit | RabbitMQ message publishing and consuming via MassTransit |
- .NET SDK 6.0, 8.0, 9.0, or 10.0
Install the packages you need via NuGet:
dotnet add package SOFTURE.Common.Authentication
dotnet add package SOFTURE.Common.CQRS
dotnet add package SOFTURE.Common.Correlation
dotnet add package SOFTURE.Common.HealthCheck
dotnet add package SOFTURE.Common.Logging
dotnet add package SOFTURE.Common.Observability
dotnet add package SOFTURE.Common.Resilience
dotnet add package SOFTURE.Common.StronglyTypedIdentifiers
dotnet add package SOFTURE.MessageBroker.RabbitAll modules integrate through IServiceCollection extension methods in your Program.cs or Startup.cs.
Configures JWT Bearer authentication with symmetric key signing.
services.AddCommonAuthentication<AppSettings>();Your settings class must implement IAuthenticationSettings and provide:
JwtSecret— symmetric signing keyValidAudience— expected token audienceValidIssuer— expected token issuer
Registers MediatR pipeline behaviors for automatic command validation using FluentValidation.
services.AddMiddlewares();Sets up Serilog with console output and Seq sink. Automatically registers a Seq health check.
services.AddCommonLogging<AppSettings>();Your settings class must implement ISeqSettings and provide:
Url— Seq server endpointApiKey— Seq API key
Configures OpenTelemetry with ASP.NET Core, HttpClient, EF Core, and Npgsql instrumentation. Exports metrics via Prometheus and traces via OTLP.
services.AddCommonObservability<AppSettings>();
// In the pipeline:
app.UseCommonOpenTelemetry();Your settings class must implement IObservabilitySettings and provide:
Url— OTLP collector endpoint
Registers a named resilience pipeline ("retry") with hedging, fallback, retry (exponential backoff with jitter), and circuit breaker strategies.
services.AddCommonResilience();Usage in application code:
// Inject ResiliencePipelineProvider<string>
var pipeline = pipelineProvider.GetPipeline<HttpResponseMessage>("retry");
var response = await pipeline.ExecuteAsync(
async token => await httpClient.GetAsync("https://api.example.com", token), ct);Registers a scoped correlation ID provider for request tracking across services.
services.AddCommonCorrelationProvider();Registers custom health checks with a standardized /hc endpoint.
services.AddCommonHealthCheck<MyCustomHealthCheck>();
// In the pipeline:
app.MapCommonHealthChecks();Health check classes must extend CheckBase and implement ICommonHealthCheck.
Configures MassTransit with RabbitMQ for publishing and consuming messages. Includes in-memory outbox, correlation logging filters, and automatic consumer discovery.
Publisher:
services.AddCommonPublisher<AppSettings>();Consumer:
services.AddCommonConsumers<AppSettings>(
assembly: typeof(Program).Assembly,
retryCount: 3,
prefetchCount: 50,
exponentialRetry: true);Your settings class must implement IRabbitSettings and provide:
Url— RabbitMQ connection URLName— queue name (consumers only)
Consumer classes are discovered automatically — any non-abstract class implementing IConsumer<IMessage> or IConsumer<IBulkMessage> in the provided assembly will be registered.
Provides type-safe entity identifiers with EF Core value converters and JSON serialization support for FastEndpoints.
EF Core configuration (in DbContext):
protected override void ConfigureConventions(ModelConfigurationBuilder configurationBuilder)
{
configurationBuilder.ConfigureStronglyIdentifiers<LanguageAssemblyMarker>();
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.ConfigureStronglyIdentifiers();
}JSON serialization:
jsonOptions.RegisterStronglyTypedIdConverters<LanguageAssemblyMarker>();Supports Guid, int, and long identifier value types.
| Framework | Status |
|---|---|
| .NET 6.0 | Supported |
| .NET 8.0 | Supported |
| .NET 9.0 | Supported |
| .NET 10.0 | Supported |
Contributions are welcome! To get started:
- Fork the repository
- Create a feature branch (
git checkout -b feature/my-feature) - Commit your changes (
git commit -m 'Add my feature') - Push to the branch (
git push origin feature/my-feature) - Open a Pull Request
cd API
dotnet restore
dotnet buildEach package has its own GitHub Actions workflow. To release a new version:
- Create a GitHub Release with a version tag (e.g.,
1.0.0) - The corresponding workflow will pack and push the package to NuGet.org
This project is licensed under the MIT License — see the LICENSE file for details.