Haya automates the generating of documentation and diagrams for a .NET codebase. It uses attributes to define concepts like Responsibilities and Collaborators. The tool uses these concepts to generate CRC descriptions and C4 Level 1 diagrams.
See the examples folder of the attribute annotations and the generated CRC.
Note: This currently only works for C# codebases.
This is not meant to be a replacement for good documentation practices, but rather a tool to help you get started, or at the least have a minimum level for a new joiner to start exploring the codebase.
- Install the Haya CLI tool
dotnet tool install --global Haya.Tool
- Add the Haya attributes package to your project
dotnet add package Haya.Core
- Run the Haya CLI tool
haya --help
- Add the Haya attributes to your codebase
using Haya;
[assembly:Meta(AppName = "CheckoutApi", Description = "Handles processing payment for a shopping cart", System = "HayaEcomm")]
namespace Example;
[Responsibility(Description = "Handles order processing")]
public class CreditCardPaymentUsecase
{ }
[Collaborator(AppName = "Checkout",
Relationship = Relationship.Internal,
Direction = Direction.Upstream,
System = "WebShop",
Description = "Handles cart checkout for a customer",
DataDescription = "Request payment")]
public class PaymentsController
{ }
Running the Haya CLI tool will generate a CRC document and a C4 Level 1 diagram.
haya crc -f md -c ./Example.sln