MicroserviceKit 0.4.5
dotnet tool install --global MicroserviceKit --version 0.4.5
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
dotnet tool install --local MicroserviceKit --version 0.4.5
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=MicroserviceKit&version=0.4.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
nuke :add-package MicroserviceKit --version 0.4.5
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
๐ 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 MassTransit
- ๐ 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 with Dockerfile, docker-compose.yml, Makefile
- ๐ 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 (recommended for beginners)
microkit generate MyService --interactive
# Quick start with enterprise template
microkit generate ArticleService --template cqrs-event-sourcing
# With custom aggregates and external services
microkit generate MyService --template cqrs-event-sourcing --aggregates Article Comment --external-services ImageService VideoService
Explore available templates
# List all templates
microkit list
# List by category
microkit list --category service-types
# Get detailed template information
microkit describe cqrs-event-sourcing.json
๐ Available Templates
๐ท๏ธ Enterprise Service Types
Perfect for production microservices with complex business requirements:
cqrs-event-sourcing.json
โญ Most Popular
- Use for: Services with complex business rules, audit trail requirements, event-driven architecture
- Complexity: Enterprise (25 minutes)
- Features: CQRS, Event Sourcing, Domain Events, Aggregate Root, PostgreSQL
- Perfect for: Article management, Order processing, Financial transactions
bpc-workflow.json
- Use for: Business process orchestration, workflow management, external system integration
- Complexity: Enterprise (30 minutes)
- Features: Workflow Engine, Saga Pattern, External Integrations, State Machine, Hangfire
- Perfect for: Payment processing, Document approval workflows, Multi-step business processes
event-store.json
- Use for: Centralized event storage, event replay, audit logs
- Complexity: Enterprise (20 minutes)
- Features: Event Store, Event Sourcing, Projections, Event Replay
- Perfect for: Event sourcing infrastructure, Audit systems, Event analytics
read-model.json
- Use for: High-performance read operations, reporting, data projections
- Complexity: Medium (15 minutes)
- Features: CQRS Read Side, MongoDB, Projections, Redis Cache, Event Handlers
- Perfect for: Reporting services, Search APIs, Data analytics
identity-auth.json
- Use for: User authentication, authorization, multi-tenant security
- Complexity: Enterprise (25 minutes)
- Features: OAuth2, JWT, RBAC, Multi-Auth, Identity Server
- Perfect for: Identity provider, User management, API security
api-gateway.json
- Use for: Centralized API management, routing, cross-cutting concerns
- Complexity: Enterprise (20 minutes)
- Features: API Gateway, Routing, Rate Limiting, Circuit Breaker, Ocelot
- Perfect for: Microservices entry point, API aggregation, Security gateway
multi-tenant.json
- Use for: SaaS applications, tenant isolation, configuration per tenant
- Complexity: Enterprise (20 minutes)
- Features: Multi-tenancy, Tenant Isolation, Configuration per Tenant, Domain Routing
- Perfect for: SaaS platforms, Multi-client systems, Tenant-specific features
legacy-adapter.json
- Use for: Integration with legacy systems, data synchronization
- Complexity: Medium (15 minutes)
- Features: Adapter Pattern, Legacy Integration, Data Sync, Anti-corruption Layer
- Perfect for: Legacy system integration, Data migration, System modernization
search-indexing.json
- Use for: Full-text search, content indexing, search analytics
- Complexity: Medium (15 minutes)
- Features: Elasticsearch, Search Indexing, Event-driven, Full-text Search
- Perfect for: Content search, Product catalogs, Document search
cqrs-simple.json
- Use for: CQRS without Event Sourcing, simpler business logic
- Complexity: Medium (15 minutes)
- Features: CQRS, Clean Architecture, PostgreSQL, Redis Cache
- Perfect for: CRUD-heavy services, Simple business logic, Standard applications
๐๏ธ Architecture Levels
Choose based on your project complexity:
standard-service.json
๐ Balanced
- Use for: Standard business applications, moderate complexity
- Complexity: Medium (10 minutes)
- Features: Clean Architecture, CQRS, SQLite, JWT Auth
- Perfect for: Business applications, Standard APIs, Moderate complexity
enterprise-service.json
๐ข Full Featured
- Use for: Enterprise applications, all patterns included
- Complexity: Complex (20 minutes)
- Features: DDD, CQRS, Event Sourcing, Microservices Patterns, Docker, Kubernetes
- Perfect for: Large enterprises, Complex domains, Full-scale microservices
๐๏ธ Generated Architecture
Every generated service includes:
MyService/
โโโ src/
โ โโโ Domain/ # Domain layer (DDD)
โ โ โโโ Aggregates/ # Aggregate roots with business logic
โ โ โโโ Entities/ # Domain entities
โ โ โโโ ValueObjects/ # Immutable value objects
โ โ โโโ Events/ # Domain events
โ โ โโโ Repositories/ # Repository interfaces
โ โโโ Application/ # Application layer (CQRS)
โ โ โโโ Commands/ # Command handlers (write operations)
โ โ โโโ Queries/ # Query handlers (read operations)
โ โ โโโ DTOs/ # Data transfer objects
โ โ โโโ Behaviors/ # Cross-cutting concerns
โ โโโ Infrastructure/ # Infrastructure layer
โ โ โโโ Persistence/ # EF Core, MongoDB, Redis
โ โ โโโ ExternalServices/ # HTTP clients with Polly
โ โ โโโ Messaging/ # MassTransit + RabbitMQ
โ โ โโโ Configuration/ # Dependency injection
โ โโโ Api/ # API layer
โ โโโ Controllers/ # REST API controllers
โ โโโ Middleware/ # Custom middleware
โ โโโ Extensions/ # Service registration
โโโ tests/
โ โโโ Unit/ # Unit tests with xUnit
โ โโโ Integration/ # Integration tests with TestContainers
โ โโโ EndToEnd/ # E2E tests
โโโ Dockerfile # Multi-stage Docker build
โโโ docker-compose.yml # Complete development environment
โโโ Makefile # Development commands
โโโ k8s/ # Kubernetes manifests
โโโ docs/ # Auto-generated documentation
๐ ๏ธ CLI Commands
๐ Generate Commands
# Interactive mode (recommended)
microkit generate MyService --interactive
# Quick generation with template
microkit generate ArticleService --template cqrs-event-sourcing
# Custom aggregates
microkit generate MyService --template cqrs-event-sourcing --aggregates Article Comment User
# External services integration
microkit generate MyService --template cqrs-event-sourcing --external-services ImageService VideoService NotificationService
# Full customization
microkit generate MyService --template cqrs-event-sourcing \
--aggregates Article Comment \
--external-services ImageService VideoService \
--database postgresql \
--output ./services/ArticleService
๐ Discovery Commands
# List all templates
microkit list
# List by category
microkit list --category service-types
microkit list --category levels
# Filter by complexity
microkit list --complexity enterprise
microkit list --complexity medium
# Detailed view with descriptions
microkit list --detailed
# Get specific template information
microkit describe cqrs-event-sourcing.json
microkit describe api-gateway.json --format json
๐ง Template Customization
Example: Article Service Configuration
{
"templateType": "cqrs-event-sourcing",
"microserviceName": "ArticleService",
"namespace": "Company.ArticleService",
"domain": {
"aggregates": [
{
"name": "Article",
"properties": [
{ "name": "Title", "type": "string", "isRequired": true },
{ "name": "Content", "type": "string", "isRequired": true },
{ "name": "Status", "type": "ArticleStatus", "isRequired": true }
],
"operations": ["Create", "Update", "Publish", "Archive"]
}
]
},
"features": {
"database": {
"writeModel": { "provider": "postgresql" },
"readModel": { "provider": "mongodb" }
},
"messaging": { "enabled": true, "provider": "rabbitmq" },
"externalServices": {
"enabled": true,
"services": [
{
"name": "ImageService",
"baseUrl": "https://api.images.com",
"operations": ["Upload", "Process", "Delete"]
}
]
}
},
"deployment": {
"docker": { "enabled": true },
"kubernetes": { "enabled": true }
}
}
๐งช Testing & Development
Generated Development Environment
Every service includes a complete development setup:
# Start development environment
make dev-setup
# Run the service
make run
# Run tests
make test
# Build Docker image
make docker-build
# Run with Docker
make docker-run
# Clean up
make clean
Testing with TestContainers
# Unit tests
dotnet test tests/Unit/
# Integration tests with real databases
dotnet test tests/Integration/
# End-to-end tests
dotnet test tests/EndToEnd/
# All tests
make test
๐ณ Docker & Kubernetes
Complete Containerization
Every generated service includes:
- Multi-stage Dockerfile - Optimized for production
- docker-compose.yml - Complete development environment with PostgreSQL, MongoDB, Redis, RabbitMQ
- Kubernetes manifests - Production-ready K8s deployment
- Health checks - Liveness and readiness probes
- Makefile - All development commands
# Development with Docker Compose
docker-compose up -d
# Build production image
docker build -t myservice:latest .
# Deploy to Kubernetes
kubectl apply -f k8s/
๐ Monitoring & Observability
Built-in Monitoring
- Health Checks -
/health
,/health/ready
,/health/live
- Metrics - ASP.NET Core built-in metrics
- Structured Logging - Serilog with correlation IDs
- Distributed Tracing - OpenTelemetry ready
# Health endpoints
curl http://localhost:5000/health
curl http://localhost:5000/health/ready
curl http://localhost:5000/health/live
# Metrics endpoint
curl http://localhost:5000/metrics
๐ Security
Authentication & Authorization
# JWT for internal services
curl -H "Authorization: Bearer <jwt-token>" \
http://localhost:5000/api/articles
# OAuth2 for external applications
curl -H "Authorization: Bearer <oauth-token>" \
http://localhost:5000/api/articles
๐ Real-World Examples
Headless CMS Architecture
# Article management service
microkit generate ArticleService --template cqrs-event-sourcing --aggregates Article ArticleBlock
# Page management service
microkit generate PageService --template cqrs-event-sourcing --aggregates Page PageLayout
# Content read service
microkit generate ContentReadService --template read-model --aggregates ArticleProjection PageProjection
# Search service
microkit generate SearchService --template search-indexing
# Identity service
microkit generate IdentityService --template identity-auth --aggregates User Role Permission
# API Gateway
microkit generate ApiGateway --template api-gateway
E-commerce Platform
# Order management
microkit generate OrderService --template cqrs-event-sourcing --aggregates Order OrderItem
# Product catalog
microkit generate ProductService --template cqrs-simple --aggregates Product Category
# Inventory management
microkit generate InventoryService --template cqrs-event-sourcing --aggregates Inventory
# Payment processing
microkit generate PaymentService --template bpc-workflow --aggregates Payment PaymentMethod
# Search service
microkit generate SearchService --template search-indexing
๐ 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
This package has no dependencies.
🚀 v0.4.5 - Templates Included: Fixed missing templates in NuGet package. All microservice templates are now properly included and accessible via CLI commands (list, describe, generate).