MicroserviceKit 0.4.0
See the version list below for details.
dotnet tool install --global MicroserviceKit --version 0.4.0
dotnet new tool-manifest
dotnet tool install --local MicroserviceKit --version 0.4.0
#tool dotnet:?package=MicroserviceKit&version=0.4.0
nuke :add-package MicroserviceKit --version 0.4.0
๐ MicroserviceKit - .NET 8 Microservice Template Generator
๐ 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 managementtag-taxonomy
- Flat taxonomy for tags and labelscategory-taxonomy
- Hierarchical taxonomy for categoriesidentity-service
- Authentication and authorization (JWT + OAuth)tenant-service
- Multi-tenancy managementbpc-service
- Business Process Control with external providerslegacy-sync
- Legacy system integration
Architecture Levels
minimal
- Single project, basic CRUDstandard
- Clean Architecture, CQRSenterprise
- 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
- Getting Started Guide
- Architecture Overview
- CLI Reference
- Template Guide
- Testing Guide
- Deployment Guide
๐ค Contributing
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Submit a pull request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Support
- ๐ Documentation
- ๐ Issues
- ๐ฌ Discussions
Built with โค๏ธ for the .NET community
Product | Versions 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. |
This package has no dependencies.
🎉 Release 0.4.0 - Template Engine Stabilization & Docker Support!
โ
CRITICAL FIXES:
- 🛠๏ธ Fixed Template Engine path resolution issues causing files generated outside src/
- 📁 Resolved directory structure problems - all files now properly placed in src/ and tests/
- 🏷๏ธ Fixed hardcoded 'Order' aggregate names - now parametrized based on service name
- 🔧 Standardized all template modules to use consistent path generation patterns
โ
NEW FEATURES:
- 🐳 Complete Docker support with Dockerfile, docker-compose.yml, and Makefile generation
- 📦 Added PostgreSQL, Redis, RabbitMQ services in docker-compose
- 🔄 Comprehensive Makefile with build, test, docker, and migration commands
- 🚀 Production-ready multi-stage Dockerfile for .NET 8
โ
MODULE IMPROVEMENTS:
- 📡 Switched from Wolverine to MassTransit for better enterprise messaging stability
- 🧪 Enhanced ApplicationModule with proper CQRS command/query generation
- 📋 Fixed ReadModelsModule and ExternalServicesModule path generation
- 🧩 Improved UnitTestModule and IntegrationTestModule file placement
โ
CODE GENERATION:
- 🏗๏ธ Fixed parameter generation to use PascalCase properties
- 📝 Improved validation rules and entity construction logic
- 🔗 Enhanced project references and dependency management
- 📊 Better string interpolation handling in generated code
🚀 PRODUCTION READY: Generate fully containerized microservices with clean architecture and proper file organization!