Start here
Quick start
Build and run your first deterministic process with the in-memory runtime.
Install the package
Wyrd targets .NET 10 and C# 14. The package includes the analyzers; add Wyrd.Testing to your test project.
dotnet add package WyrdDescribe the messages
Commands are intentions. Domain events are internal facts. Integration events are explicit, versioned public contracts.
// An intention sent to exactly one owner
public sealed record ChargePayment(string OrderId, decimal Amount) : ICommand;
// An internal fact inside one bounded context
public sealed record PaymentCharged(string OrderId, decimal Amount) : IDomainEvent;
// A versioned public contract across boundaries
[IntegrationEvent("payments.payment-charged", Version = 1)]
public sealed record PaymentChargedV1(string OrderId, decimal Amount, string Currency)
: IIntegrationEvent;Keep the decision pure
A slice owns one command and decides against the current immutable state. Expected failure is a value, not an exception.
public sealed class ChargePaymentSlice : Slice<ChargePayment, Payment, PaymentCharged, PaymentError>
{
public override object KeyOf(ChargePayment command) => command.OrderId;
public override Result<PaymentCharged, PaymentError> Decide(ChargePayment command, Payment payment) => payment switch
{
Payment.None when command.Amount > 1_000m => PaymentError.CardDeclined,
Payment.None => new PaymentCharged(command.OrderId, command.Amount),
Payment.Charged or Payment.Refunded => PaymentError.AlreadyCharged,
};
}Compose the process
Connect business steps, retries, compensation, and timeouts without exposing infrastructure to domain code.
public static Process OrderFulfillment => Process
.StartOn<OrderPlaced>(e => e.OrderId)
.Then(Stock.Reserve).Retry(5.Times).Undo(Stock.Release)
.Then(Payments.Charge).Retry(5.Times, Backoff.Exponential).Undo(Payments.Refund)
.Await<PaymentConfirmed>(e => e.OrderId).Within(15.Minutes)
.Then(Shipping.Ship).Retry(5.Times)
.OnCompensated(Orders.Cancel).Retry(5.Times);Run it durable
The same module runs on PostgreSQL or SQL Server through EF Core: you choose the retention, run workers, and connect services over RabbitMQ. Read the Running durable guide.
Generate documentation from the model
The Wyrd CLI exports AsyncAPI contracts and Mermaid process diagrams. Read the CLI guide for commands you can run from the repository today.