Welcome to FlowZap, the App to diagram with Speed, Clarity and Control.

Cqrs Workflow

patterns

CQRS (Command Query Responsibility Segregation) pattern with separate command and query paths, domain event publishing, read model synchronization, and DTO transformation.

Full FlowZap Code

Client { # Client Application
n1: circle label:"Start"
n2: rectangle label:"User initiates action"
n3: diamond label:"Read or write?"
n4: rectangle label:"Send command"
n5: rectangle label:"Send query"
n6: rectangle label:"Receive response"
n7: circle label:"End"
n1.handle(right) -> n2.handle(left)
n2.handle(right) -> n3.handle(left)
n3.handle(right) -> n4.handle(left) [label="Write"]
n3.handle(bottom) -> n5.handle(top) [label="Read"]
n4.handle(bottom) -> CommandSide.n8.handle(top) [label="Command"]
n5.handle(bottom) -> QuerySide.n16.handle(top) [label="Query"]
n6.handle(right) -> n7.handle(left)
}
CommandSide { # Command Side
n8: rectangle label:"Validate command"
n9: diamond label:"Command valid?"
n10: rectangle label:"Execute domain logic"
n11: rectangle label:"Persist to write store"
n12: rectangle label:"Publish domain event"
n13: rectangle label:"Return validation error"
n8.handle(right) -> n9.handle(left)
n9.handle(right) -> n10.handle(left) [label="Yes"]
n9.handle(bottom) -> n13.handle(top) [label="No"]
n10.handle(right) -> n11.handle(left)
n11.handle(right) -> n12.handle(left)
n12.handle(bottom) -> EventHandler.n14.handle(top) [label="Event"]
n12.handle(top) -> Client.n6.handle(bottom) [label="Success"]
n13.handle(top) -> Client.n6.handle(bottom) [label="Error"]
}
EventHandler { # Event Handler
n14: rectangle label:"Receive domain event"
n15: rectangle label:"Update read model"
n14.handle(right) -> n15.handle(left)
n15.handle(top) -> QuerySide.n16.handle(bottom) [label="Sync"]
}
QuerySide { # Query Side
n16: rectangle label:"Parse query parameters"
n17: rectangle label:"Query read store"
n18: rectangle label:"Transform to DTO"
n19: rectangle label:"Return results"
n16.handle(right) -> n17.handle(left)
n17.handle(right) -> n18.handle(left)
n18.handle(right) -> n19.handle(left)
n19.handle(top) -> Client.n6.handle(bottom) [label="Data"]
}

Related templates

Event-Driven CQRS with Event Store Architecture

Architecture

A CQRS architecture diagram combining separate command and query APIs with an event bus for asynchronous read model synchronization, including projectors that build denormalized views from domain events. This template demonstrates the full CQRS+ES stack where writes go through domain validation and reads are served from optimized materialized views. Ideal for high-throughput systems where read and write workloads have fundamentally different scaling requirements.

Event Sourcing Workflow

patterns

Event sourcing pattern with event capture, event store persistence, aggregate reconstruction, snapshot optimization, and temporal state queries.

Saga Pattern Workflow

patterns

Saga orchestration pattern for distributed transactions across Order, Payment, and Shipping services with automatic compensation rollback on failures.

Api Gateway Workflow

patterns

API Gateway pattern with request authentication, rate limiting, request routing to backend services, response aggregation, and error handling.

Back to all templates