Myth.Tool
4.4.2
dotnet tool install --global Myth.Tool --version 4.4.2
dotnet new tool-manifest
dotnet tool install --local Myth.Tool --version 4.4.2
#tool dotnet:?package=Myth.Tool&version=4.4.2
nuke :add-package Myth.Tool --version 4.4.2
<img style="float: right;" src="myth-tool-logo.png" alt="drawing" width="250"/>
Myth.Tool - Code Generation CLI
A modern CLI tool for generating Myth architecture code with CQRS, DDD, and Clean Architecture patterns.
π― Why Myth.Tool?
Setting up CQRS, DDD, and Clean Architecture projects takes days. Creating project structure, writing commands/queries/events from scratch, copy-pasting repository code, setting up controllersβrepetitive and error-prone. Myth.Tool generates production-ready code in seconds, scaffolding entire CQRS workflows, DDD aggregates, repositories, controllers, and tests with one command.
The Problem
New projects take days to structure. CQRS boilerplate (commands, handlers, queries) copy-pasted. DDD patterns manually implemented. Repository code duplicated. Controller CRUD repeated. Tests not generatedβdevelopers skip them.
The Solution
Project scaffolding: myth init creates complete Clean Architecture structure. Code generation: Generate commands, queries, events with handlers in seconds. DDD support: Domain models with value objects and validation. Repositories: Auto-generate with read/write separation. Controllers: CRUD endpoints auto-created. Tests: Generate xUnit test suites automatically.
Key Benefits
10x faster project setup: Days β minutes. Consistent patterns: All generated code follows Myth patterns. Tests included: Generated code comes with test suites. Learning tool: Study generated code to learn patterns.
Features
- Project Setup: Initialize Myth project structure from templates
- Domain Models: Generate domain models with validation and value objects
- CQRS Commands: Create commands with handlers and validation
- CQRS Queries: Generate queries with handlers and DTOs
- CQRS Events: Create domain events with handlers
- Repository Pattern: Generate repositories with read/write separation
- API Controllers: Create REST API controllers with CRUD operations
- Unit Tests: Generate comprehensive test suites with xUnit and FluentAssertions
Installation
Install as a global .NET tool:
dotnet tool install -g Myth.Tool
Update to latest version:
dotnet tool update -g Myth.Tool
Quick Start
Setup a new Myth project:
myth setup MyProject --clean
Create a domain model:
myth create model WeatherForecast \
-p WeatherForecastId:Guid \
-p Date:DateOnly \
-p TemperatureF:int \
-p Summary:string \
--validate
Create a command with handler:
myth create command WeatherForecast CreateWeatherForecast \
-p Date:DateOnly \
-p TemperatureF:int \
-p Summary:string \
--return Guid \
--validate
Commands
Project Management
myth setup <ProjectName> [--clean]- Setup Myth project structure from templatemyth version- Display version information
Code Generation
myth create model <name>- Generate domain entitymyth create command <aggregate> <name>- Generate CQRS command with handlermyth create query <aggregate> <name>- Generate CQRS query with handlermyth create event <aggregate> <name>- Generate domain event with handlermyth create dto <aggregate> <name>- Generate data transfer objectmyth create repository <name>- Generate repository interfaces and implementationsmyth create controller <name>- Generate API controller with CRUD operationsmyth create test <controller>- Generate unit tests for controllers
Options
Global Options
--dry-run- Preview changes without creating files--force- Overwrite existing files--path <path>- Specify target directory--namespace <namespace>- Custom namespace
Setup Options
--clean- Remove WeatherForecast examples and create clean base context
Create Options
-p <property>- Add property (format: Name:Type or Name:Type:required)--return <type>- Specify return type for commands/queries--validate- Enable validation support--events <events>- Specify events to publish (comma-separated)--type <type>- Repository type: read|write|readwrite (default: readwrite)
Examples
Project Setup
# Setup new project with clean structure
myth setup OrderManagement --clean
# Setup project keeping examples
myth setup OrderManagement
Complete CRUD Generation
# Generate domain model
myth create model User \
-p Id:Guid \
-p Name:string:required \
-p Email:string:required \
-p CreatedAt:DateTime \
--validate
# Generate command
myth create command User CreateUser \
-p Name:string:required \
-p Email:string:required \
--return Guid \
--validate \
--events UserCreated
# Generate query
myth create query User GetUser \
-p Id:Guid:required \
--return GetUserResponse
# Generate repository
myth create repository User --type readwrite
# Generate controller
myth create controller User
# Generate tests
myth create test UserController
Advanced Examples
# Create read-only repository
myth create repository UserRead --type read
# Create command with multiple events
myth create command Order ProcessOrder \
-p OrderId:Guid:required \
-p Status:string:required \
--return bool \
--events OrderProcessed,OrderStatusChanged
# Create DTO for complex data transfer
myth create dto Order CreateOrderRequest \
-p CustomerId:Guid:required \
-p Items:"List<OrderItemDto>":required \
-p DeliveryDate:DateTime
Project Structure
The tool generates code following Clean Architecture principles:
YourProject/
βββ ποΈ YourProject.Api/ # Web API Layer
β βββ Controllers/ # REST API Controllers
βββ π― YourProject.Domain/ # Domain Layer
β βββ Entities/ # Domain Models
β βββ Events/ # Domain Events
βββ π YourProject.Application/ # Application Layer
β βββ Commands/ # CQRS Commands
β βββ Queries/ # CQRS Queries
β βββ Handlers/ # Command/Query/Event Handlers
β βββ DTOs/ # Data Transfer Objects
βββ πΎ YourProject.Data/ # Data Access Layer
β βββ Repositories/ # Repository Implementations
β βββ Context/ # Entity Framework Context
βββ π§ͺ YourProject.Test/ # Test Projects
βββ Controllers/ # Unit Tests
Generated Code Features
Integration with Myth Framework
Generated code uses:
- Myth.Flow - Pipeline pattern for business logic orchestration
- Myth.Flow.Actions - CQRS implementation (ICommand, IQuery, IEvent, IDispatcher)
- Myth.Guard - Fluent validation (IValidatable, ValidationBuilder)
- Myth.Repository - Repository pattern with read/write separation
- Myth.Commons - Common extensions and utilities
Command Handlers
- Implement
ICommandHandler<TCommand>orICommandHandler<TCommand, TResponse> - Support validation via Myth.Guard
- Event publishing via IDispatcher
- Pipeline integration for complex workflows
Query Handlers
- Implement
IQueryHandler<TQuery, TResponse> - Repository integration for data access
- Support for caching and optimization
Domain Events
- Implement
IEventinterface - Event handlers implement
IEventHandler<TEvent> - Async event processing support
Repositories
- Support read/write separation
- Generic repository pattern
- Entity Framework Core integration
- Unit of Work pattern
Controllers
- Full CRUD operations
- Async/await patterns
- Proper HTTP status codes
- Request/response DTOs
Tests
- xUnit framework with FluentAssertions
- In-memory database testing
- Service mocking and dependency injection
- Inherits from
BaseDatabaseTests<TContext>
Contributing
This tool is part of the Myth framework. For contributions and issues, please visit the Myth repository.
License
Licensed under the Apache 2.0 License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. 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.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.4.2 | 38 | 6/7/2026 |
| 4.4.1 | 45 | 6/5/2026 |
| 4.4.0 | 43 | 6/5/2026 |
| 4.4.0-preview.12 | 46 | 6/4/2026 |
| 4.4.0-preview.11 | 39 | 6/4/2026 |
| 4.4.0-preview.10 | 48 | 6/2/2026 |
| 4.4.0-preview.9 | 37 | 6/2/2026 |
| 4.4.0-preview.8 | 75 | 3/12/2026 |
| 4.4.0-preview.7 | 59 | 3/12/2026 |
| 4.4.0-preview.6 | 74 | 2/20/2026 |
| 4.4.0-preview.5 | 66 | 2/19/2026 |
| 4.4.0-preview.4 | 65 | 2/18/2026 |
| 4.4.0-preview.3 | 68 | 2/18/2026 |
| 4.4.0-preview.2 | 70 | 2/17/2026 |
| 4.4.0-preview.1 | 66 | 2/14/2026 |
| 4.3.0 | 121 | 2/1/2026 |
| 4.3.0-preview.3 | 69 | 2/1/2026 |
| 4.3.0-preview.2 | 150 | 12/22/2025 |
| 4.2.1-preview.1 | 640 | 12/2/2025 |
| 4.2.0 | 433 | 11/30/2025 |
Initial release of Myth code generation tool with support for models, commands, and queries generation