MicroserviceKit 0.4.2

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global MicroserviceKit --version 0.4.2
                    
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 MicroserviceKit --version 0.4.2
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=MicroserviceKit&version=0.4.2
                    
nuke :add-package MicroserviceKit --version 0.4.2
                    

๐Ÿš€ MicroserviceKit - .NET 8 Microservice Template Generator

NuGet Version NuGet Downloads .NET License: MIT GitHub

๐Ÿš€ Complete toolkit for generating production-ready .NET 8 microservices with DDD, CQRS, Clean Architecture, Event-Driven Architecture, and comprehensive infrastructure.

โœจ Features

  • ๐Ÿ—๏ธ Clean Architecture - Domain, Application, Infrastructure, API layers
  • ๐Ÿ“ฆ Domain-Driven Design - Aggregates, Entities, Value Objects, Domain Events
  • โšก CQRS Pattern - Command Query Responsibility Segregation with Wolverine
  • ๐Ÿ”„ Event-Driven Architecture - RabbitMQ, MassTransit, Domain Events
  • ๐Ÿ—„๏ธ Multi-Database Support - PostgreSQL (write), MongoDB (read), Redis (cache)
  • ๐Ÿ”— External Services Integration - HTTP clients with Polly resilience
  • ๐Ÿงช Comprehensive Testing - Unit, Integration, E2E with TestContainers
  • ๐Ÿณ Docker & Kubernetes - Production-ready containerization
  • ๐Ÿ“Š Monitoring & Health Checks - Built-in observability
  • ๐Ÿ” Security - JWT authentication, OAuth2, RBAC
  • ๐ŸŒ API Gateway - Centralized routing and authentication

๐Ÿš€ Quick Start

Install the CLI tool

dotnet tool install -g MicroserviceKit

Generate your first microservice

# Interactive mode
microkit generate MyService --interactive

# Using a template
microkit generate ArticleService --template article-service

# With customizations
microkit generate MyService --template cqrs-event-sourcing --aggregates Article Comment --external-services ImageService

List available templates

microkit list templates
microkit list templates --category service-types
microkit describe article-service

๐Ÿ“‹ Available Templates

Service Types

  • article-service - CQRS + Event Sourcing for content management
  • tag-taxonomy - Flat taxonomy for tags and labels
  • category-taxonomy - Hierarchical taxonomy for categories
  • identity-service - Authentication and authorization (JWT + OAuth)
  • tenant-service - Multi-tenancy management
  • bpc-service - Business Process Control with external providers
  • legacy-sync - Legacy system integration

Architecture Levels

  • minimal - Single project, basic CRUD
  • standard - Clean Architecture, CQRS
  • enterprise - Full DDD, Event Sourcing, External Services

๐Ÿ—๏ธ Generated Architecture

MyService/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ Domain/                 # Domain layer
โ”‚   โ”‚   โ”œโ”€โ”€ Aggregates/         # Aggregate roots
โ”‚   โ”‚   โ”œโ”€โ”€ Entities/           # Domain entities
โ”‚   โ”‚   โ”œโ”€โ”€ ValueObjects/       # Value objects
โ”‚   โ”‚   โ”œโ”€โ”€ Events/             # Domain events
โ”‚   โ”‚   โ””โ”€โ”€ Repositories/       # Repository interfaces
โ”‚   โ”œโ”€โ”€ Application/            # Application layer
โ”‚   โ”‚   โ”œโ”€โ”€ Commands/           # Command handlers
โ”‚   โ”‚   โ”œโ”€โ”€ Queries/            # Query handlers
โ”‚   โ”‚   โ”œโ”€โ”€ DTOs/               # Data transfer objects
โ”‚   โ”‚   โ””โ”€โ”€ Behaviors/          # Cross-cutting concerns
โ”‚   โ”œโ”€โ”€ Infrastructure/         # Infrastructure layer
โ”‚   โ”‚   โ”œโ”€โ”€ Persistence/        # Database context & repositories
โ”‚   โ”‚   โ”œโ”€โ”€ ExternalServices/   # HTTP clients
โ”‚   โ”‚   โ”œโ”€โ”€ Messaging/          # Event publishing
โ”‚   โ”‚   โ””โ”€โ”€ Configuration/      # App configuration
โ”‚   โ””โ”€โ”€ Api/                    # API layer
โ”‚       โ”œโ”€โ”€ Controllers/        # REST controllers
โ”‚       โ”œโ”€โ”€ Middleware/         # Custom middleware
โ”‚       โ””โ”€โ”€ Extensions/         # Service registration
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ Unit/                   # Unit tests
โ”‚   โ”œโ”€โ”€ Integration/            # Integration tests
โ”‚   โ””โ”€โ”€ EndToEnd/               # E2E tests
โ”œโ”€โ”€ docker/                     # Docker configuration
โ”œโ”€โ”€ k8s/                        # Kubernetes manifests
โ””โ”€โ”€ docs/                       # Documentation

๐Ÿ”ง Configuration

Template Customization

{
  "templateType": "article-service",
  "microserviceName": "ArticleService",
  "namespace": "Company.ArticleService",
  "domain": {
    "aggregates": [
      {
        "name": "Article",
        "properties": [
          { "name": "Title", "type": "string", "isRequired": true },
          { "name": "Content", "type": "string", "isRequired": true }
        ],
        "operations": ["Create", "Update", "Publish"]
      }
    ]
  },
  "features": {
    "database": {
      "writeModel": { "provider": "postgresql" },
      "readModel": { "provider": "mongodb" }
    },
    "messaging": { "enabled": true, "provider": "rabbitmq" },
    "externalServices": {
      "enabled": true,
      "services": ["ImageService", "VideoService"]
    }
  }
}

๐Ÿ› ๏ธ CLI Commands

Generate Commands

# Basic generation
microkit generate MyService --template article-service

# Interactive mode
microkit generate MyService --interactive

# Custom aggregates
microkit generate MyService --template article-service --aggregates Article Comment User

# External services
microkit generate MyService --template article-service --external-services ImageService VideoService

# Database and messaging
microkit generate MyService --template article-service --database postgresql --messaging rabbitmq

List Commands

# List all templates
microkit list templates

# Filter by category
microkit list templates --category service-types

# Filter by complexity
microkit list templates --complexity enterprise

# Detailed view
microkit list templates --detailed

Describe Commands

# Template details
microkit describe article-service

# Different formats
microkit describe article-service --format json
microkit describe article-service --format markdown

History Commands

# Show generation history
microkit history

# Different formats
microkit history --format json
microkit history --format summary

๐Ÿงช Testing

Run Tests

# Unit tests
dotnet test tests/Unit/

# Integration tests
dotnet test tests/Integration/

# All tests
dotnet test

Test with TestContainers

# Start test containers
docker-compose -f tests/docker-compose.test.yml up -d

# Run integration tests
dotnet test tests/Integration/ --filter Category=Integration

๐Ÿณ Docker & Kubernetes

Build and Run

# Build image
docker build -t myservice:latest .

# Run with Docker Compose
docker-compose up -d

# Deploy to Kubernetes
kubectl apply -f k8s/

๐Ÿ“Š Monitoring

Health Checks

# Health endpoint
curl http://localhost:5000/health

# Readiness check
curl http://localhost:5000/health/ready

# Liveness check
curl http://localhost:5000/health/live

Metrics

# Prometheus metrics
curl http://localhost:5000/metrics

๐Ÿ” Security

Authentication

# JWT for internal users
curl -H "Authorization: Bearer <jwt-token>" http://localhost:5000/api/articles

# OAuth2 for external apps
curl -H "Authorization: Bearer <oauth-token>" http://localhost:5000/api/articles

๐Ÿ“š Documentation

๐Ÿค Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ†˜ Support


Built with โค๏ธ for the .NET community

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.

This package has no dependencies.

Version Downloads Last Updated
0.4.5 77 6/20/2025
0.4.4 96 6/20/2025
0.4.2 108 6/20/2025
0.4.1 134 6/20/2025
0.4.0 134 6/20/2025
0.3.0 293 6/10/2025
0.2.0 216 6/9/2025
0.1.0-beta 189 6/8/2025

🎉 Release 0.4.2 - Docker & Makefile Generation Fixed!

🐳 DOCKER SUPPORT FULLY WORKING:
- โœ… Fixed DockerModule configuration structure to match JSON templates
- โœ… All enterprise templates now generate Dockerfile, docker-compose.yml, and Makefile
- โœ… Added DockerConfiguration and KubernetesConfiguration classes
- โœ… Fixed deployment configuration parsing for nested Docker settings
- โœ… Templates generate 64 files instead of 61 (added 3 Docker files)

🏗๏ธ ENTERPRISE TEMPLATES ENHANCED:
- โœ… cqrs-event-sourcing: Full Docker support with multi-stage builds
- โœ… bpc-workflow: Complete containerization with PostgreSQL, Redis, RabbitMQ
- โœ… read-model: Docker Compose with all required services
- โœ… event-store: Production-ready Docker configuration

📋 MAKEFILE GENERATION:
- โœ… Complete Makefile with build, run, test, docker-build, docker-run commands
- โœ… Database migration commands (migrate, migration)
- โœ… Development environment setup (dev-setup, dev-stop)
- โœ… Docker container management (docker-logs, docker-stop)

🚀 PRODUCTION READY: Full Docker & Makefile support for all enterprise microservices!