CQRS has an unfortunate reputation because it usually arrives packaged with event sourcing, eventual consistency and a broker nobody asked for. The core idea is much smaller and much more useful: reads and writes have different shapes, so stop forcing them through one model. TaskFlow is built this way and uses none of the expensive parts.
The tension made concrete
A board wants every task in a project, grouped into columns, each card flattened to the handful of fields the UI draws. A status change wants one TaskItem loaded with its invariants intact so it can refuse an illegal transition. Serve both from the same entity graph and you get either an over-fetching read or a write model shredded by projection concerns.
The read side answers with types that exist only for the screen. Nothing here is a domain entity:
public sealed record BoardCardDto(
Guid Id,
string Key,
string Title,
TaskPriority Priority,
DateTime? DueDateUtc,
Guid? AssigneeId,
bool IsOverdue,
IReadOnlyList<Guid> LabelIds,
IReadOnlyList<TaskItemStatus> AllowedStatusTargets);
public sealed record BoardColumnDto(TaskItemStatus Status, IReadOnlyList<BoardCardDto> Cards);
public sealed record BoardDto(Guid ProjectId, IReadOnlyList<BoardColumnDto> Columns);
AllowedStatusTargets is the detail I would defend hardest. The domain already knows which transitions are legal from a given status, so the read model carries them and the UI greys out the rest without duplicating the rule in TypeScript. The read side stays dumb; the domain stays the single source of that answer.
One handler, one shape
The query handler checks access, asks a repository for the tasks, and shapes them. Every column is emitted even when empty, so the board does not reflow as cards move between them:
var tasks = await _taskItems
.ListByProjectAsync(request.ProjectId, cancellationToken)
.ConfigureAwait(false);
var columns = columnOrder
.Select(status => new BoardColumnDto(
status,
tasks
.Where(task => task.Status == status)
.OrderByDescending(task => task.Priority)
.ThenBy(task => task.DueDateUtc ?? DateTime.MaxValue)
.ThenBy(task => task.CreatedAtUtc)
.Select(task => new BoardCardDto(
task.Id,
task.Key,
task.Title,
task.Priority,
task.DueDateUtc,
task.AssigneeId,
task.IsOverdue(asOfUtc),
task.Labels.Select(link => link.LabelId).ToArray(),
task.AllowedStatusTargets().OrderBy(target => target).ToArray()))
.ToArray()))
.ToArray();
Worth being precise about what this is not: the projection runs in memory, after the repository has materialised the entities. It is not a database-side projection, and there is no ordering trick hiding in the repository — the sort is right there in the handler. That is a deliberate trade. Reads stay behind the same repository abstraction as writes, at the cost of loading more than the screen strictly needs.
What you actually adopt
- Two folders per feature: Commands and Queries. That is the whole structural change.
- Marker interfaces over MediatR — IQuery for reads, ICommand for writes — so the two sides stay visually separate and the pipeline can treat them differently later.
- Queries return DTOs shaped for a screen. Commands load aggregates and enforce invariants. Neither borrows the other’s model.
- One database, same transaction. No eventual consistency unless you have a reason.
The marker interfaces are four lines and earn their place: IQuery<T> : IRequest<T> and ICommand : IRequest<Unit>. Wrapping commands in a transaction and leaving queries alone becomes a pipeline behaviour rather than a convention people have to remember.
What you skip
Event sourcing, read replicas, a separate read store, and a broker are all independent decisions. Each is justified by a specific pressure — audit requirements, read scale, cross-service integration. Adopt them when that pressure exists, not because a diagram showed them next to the letters CQRS.
Separating the models is the pattern. Everything else usually attached to the acronym is an optional, expensive add-on.