NovusCore.Shared.Data 2.1.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package NovusCore.Shared.Data --version 2.1.0
                    
NuGet\Install-Package NovusCore.Shared.Data -Version 2.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="NovusCore.Shared.Data" Version="2.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NovusCore.Shared.Data" Version="2.1.0" />
                    
Directory.Packages.props
<PackageReference Include="NovusCore.Shared.Data" />
                    
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 NovusCore.Shared.Data --version 2.1.0
                    
#r "nuget: NovusCore.Shared.Data, 2.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 NovusCore.Shared.Data@2.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=NovusCore.Shared.Data&version=2.1.0
                    
Install as a Cake Addin
#tool nuget:?package=NovusCore.Shared.Data&version=2.1.0
                    
Install as a Cake Tool

RetireAix Shared Service

A Clean Architecture .NET 8 Web API microservice following CQRS pattern with EF Core and Dapper.

๐Ÿ—๏ธ Architecture

This project follows a pragmatic architecture pattern optimized for 40 microservices sharing a single PostgreSQL database:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚         Presentation (WebApi)            โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚   Infrastructure   โ”‚   Application      โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚   Shared.Data (NuGet) โ”‚    Shared       โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Layers

  • Shared.Data (NuGet v2.0.0): Entities, repositories, migrations - shared across 40 microservices
  • Shared: Common DTOs, models, and utilities
  • Application: CQRS implementation with MediatR (Commands/Queries/Handlers)
  • Infrastructure: AWS services (S3, Secrets Manager, SQS), Redis, Email
  • WebApi: REST API controllers and middleware

๐Ÿš€ Getting Started

Prerequisites

  • .NET 8 SDK
  • PostgreSQL 16+
  • Redis (optional for caching)
  • AWS Account (optional for cloud services)

Installation

  1. Clone the repository

    git clone https://github.com/your-org/retireaix-shared-service.git
    cd retireaix-shared-service
    
  2. Restore dependencies

    dotnet restore
    
  3. Update connection string

    Edit src/RetireAix.SharedService.WebApi/appsettings.json:

    "ConnectionStrings": {
      "DefaultConnection": "Host=localhost;Port=5432;Database=sharedservice_db;Username=postgres;Password=yourpassword;"
    }
    
  4. Create database migration

    cd src/RetireAix.Shared.Data
    dotnet ef migrations add InitialCreate --startup-project ../RetireAix.SharedService.WebApi
    dotnet ef database update --startup-project ../RetireAix.SharedService.WebApi
    
  5. Run the application

    cd src/RetireAix.SharedService.WebApi
    dotnet run
    
  6. Access Swagger UI

    Navigate to: https://localhost:5001 or http://localhost:5000

๐Ÿ“ Project Structure

RetireAix.SharedService/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ RetireAix.Shared.Data/              # NuGet Package: Entities, Repos, Migrations
โ”‚   โ”œโ”€โ”€ RetireAix.SharedService.Shared/     # Models, DTOs, Constants
โ”‚   โ”œโ”€โ”€ RetireAix.SharedService.Application/    # CQRS, Handlers, Validators
โ”‚   โ”œโ”€โ”€ RetireAix.SharedService.Infrastructure/ # AWS, Redis, Email services
โ”‚   โ””โ”€โ”€ RetireAix.SharedService.WebApi/         # Controllers, Middleware, Health Checks
โ”œโ”€โ”€ tests/
โ”‚   โ””โ”€โ”€ RetireAix.SharedService.Tests/
โ””โ”€โ”€ docs/
    โ”œโ”€โ”€ arch.md
    โ”œโ”€โ”€ CONFIGURATION_GUIDE.md
    โ”œโ”€โ”€ IMPLEMENTATION_GUIDE.md
    โ””โ”€โ”€ PROJECT_STRUCTURE.md

๐Ÿ› ๏ธ Technology Stack

Technology Version Purpose
.NET 8.0 Framework
PostgreSQL 16+ Database
Entity Framework Core 8.0.10 ORM (Write)
Dapper 2.1.35 Micro-ORM (Read)
MediatR 12.2+ CQRS Mediator
FluentValidation 11.9+ Validation
AutoMapper 12.0+ Object Mapping
Serilog 8.0+ Logging
AWS SDK 3.7.400+ Cloud Services
Redis 7+ Caching
MailKit 4.3+ Email
Swashbuckle 6.5+ API Documentation
Polly 8.0+ Resilience & Retry
Asp.Versioning 8.1.1 API Versioning
AspNetCore.HealthChecks 9.0+ Advanced Health Monitoring

๐Ÿ“Š Database

Commands (Write Operations)

  • Uses EF Core with change tracking
  • Automatic audit trail (CreatedAt, UpdatedAt, etc.)
  • Soft delete support
  • Transaction management via Unit of Work

Queries (Read Operations)

  • Uses Dapper for high-performance reads
  • Raw SQL queries
  • No change tracking overhead
  • Direct DTO mapping

๐Ÿ”ง Configuration

Environment Variables

# Database
ConnectionStrings__DefaultConnection="Host=localhost;Port=5432;Database=mydb;Username=postgres;Password=pass;"

# AWS
AWS_REGION="us-east-1"
AWS_ACCESS_KEY_ID="your-access-key"
AWS_SECRET_ACCESS_KEY="your-secret-key"

# Redis
Redis__ConnectionString="localhost:6379"

# Email
Email__SmtpHost="smtp.gmail.com"
Email__SmtpPort="587"
Email__Username="your-email@gmail.com"
Email__Password="your-app-password"

๐Ÿฅ Health Checks

The service provides comprehensive health monitoring through multiple endpoints:

Health Check Endpoints

Complete Health Check
GET /health

Returns detailed health status of all dependencies:

{
  "status": "Healthy",
  "totalDuration": 45.23,
  "checks": [
    {
      "name": "postgresql",
      "status": "Healthy",
      "description": "No description provided",
      "duration": 23.45,
      "tags": ["db", "sql", "postgresql", "ready"]
    },
    {
      "name": "redis",
      "status": "Healthy",
      "description": "No description provided",
      "duration": 12.34,
      "tags": ["cache", "redis", "ready"]
    },
    {
      "name": "aws-s3",
      "status": "Healthy",
      "description": "No description provided",
      "duration": 9.44,
      "tags": ["aws", "s3", "storage", "ready"]
    }
  ],
  "timestamp": "2026-01-20T10:30:00Z"
}
Readiness Probe (Kubernetes)
GET /health/ready

Checks if the application is ready to serve traffic. Returns only checks tagged with "ready".

Liveness Probe (Kubernetes)
GET /health/live

Simple check to verify the application is running. Always returns "Healthy" if the app responds.

Health Check Configuration

Health checks are automatically configured for:

  • PostgreSQL - Database connectivity (5s timeout)
  • Redis - Cache connectivity (3s timeout)
  • AWS S3 - Storage service availability (5s timeout)

Configure thresholds in appsettings.json:

"HealthChecks": {
  "TimeoutSeconds": {
    "PostgreSQL": 5,
    "Redis": 3,
    "S3": 5
  }
}

Kubernetes Integration

Use these probes in your Kubernetes deployment:

livenessProbe:
  httpGet:
    path: /health/live
    port: 80
  initialDelaySeconds: 10
  periodSeconds: 30

readinessProbe:
  httpGet:
    path: /health/ready
    port: 80
  initialDelaySeconds: 5
  periodSeconds: 10

๐Ÿงช Testing

# Run all tests
dotnet test

# Run tests with coverage
dotnet test /p:CollectCoverage=true

๐Ÿณ Docker

Build Image

docker build -t retireaix-shared-service:latest .

Run with Docker Compose

docker-compose up -d

โœจ Production-Ready Features

This service includes enterprise-grade features for production deployments:

Observability & Monitoring

  • โœ… Correlation ID Tracking - Distributed tracing across microservices
  • โœ… Enhanced Logging - Structured logs with Serilog (IP, UserAgent, timing)
  • โœ… Advanced Health Checks - Multiple endpoints with detailed JSON responses
    • /health - Complete health check (PostgreSQL, Redis, AWS S3)
    • /health/ready - Readiness probe for Kubernetes
    • /health/live - Liveness probe for container orchestration
  • โœ… Request Logging - Every request logged with enriched context

Resilience & Reliability

  • โœ… Retry Policies - Automatic retry with exponential backoff (Polly)
  • โœ… Circuit Breaker - Prevent cascade failures
  • โœ… EF Core Retry - Database connection resilience (3 retries, 30s delay)
  • โœ… Rate Limiting - IP-based rate limiting (100 req/min)

Performance

  • โœ… Response Compression - Gzip compression for JSON/XML
  • โœ… Response Caching - HTTP-level caching for GET requests
  • โœ… Memory Cache - In-process caching alongside Redis
  • โœ… Async/Await - All I/O operations are asynchronous

Security

  • โœ… HSTS Headers - Force HTTPS in production
  • โœ… Input Validation - FluentValidation on all commands
  • โœ… SQL Injection Prevention - Parameterized queries
  • โœ… Error Information Hiding - Generic errors in production
  • โœ… CORS Configuration - Cross-origin request control

API Features

  • โœ… API Versioning - URL segment + header versioning
  • โœ… Swagger/OpenAPI - Interactive API documentation
  • โœ… Global Exception Handling - Consistent error responses
  • โœ… Result Pattern - Standardized response format

Data Access

  • โœ… CQRS Pattern - Separate read/write models
  • โœ… Dapper snake_case Mapping - Auto-map PostgreSQL columns
  • โœ… Soft Delete - Logical deletion with audit trail
  • โœ… Centralized Configuration - Strongly-typed config with validation

See IMPLEMENTATION_GUIDE.md for detailed documentation.

๐Ÿ“– Documentation

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is licensed under the MIT License.

๐Ÿ‘ฅ Team

  • RetireAix Development Team
  • Contact: support@retireaix.com

Generated with โค๏ธ using Pragmatic Architecture and CQRS patterns

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  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

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2.2.12 105 2/24/2026
2.2.11 86 2/23/2026
2.2.10 83 2/23/2026
2.2.9 84 2/21/2026
2.2.8 84 2/21/2026
2.2.7 83 2/21/2026
2.2.5 93 2/20/2026
2.2.4 99 2/17/2026
2.2.3 86 2/17/2026
2.2.2 90 2/16/2026
2.2.1 95 2/16/2026
2.2.0 91 2/15/2026
2.1.0 90 2/15/2026
2.0.9 90 2/14/2026
2.0.8 92 2/14/2026
2.0.7 95 2/8/2026
2.0.6 88 2/7/2026
2.0.5 104 2/3/2026
2.0.4 113 2/3/2026