
CQRS into Clean Architecture. The Read Path Got a Fast Path, and the Domain Got Smaller
How CQRS inside Clean Architecture gave reads a fast path while keeping writes honest — and the domain got simpler, not bigger. *Part 4 — ← Part 1: Clean Architecture in Kotlin | ← Part 2: Your Tests Are Slow Because Your Architecture Has No Seams | ← Part 3: I Swapped the Database Client and Added GraphQL. The Domain Never Noticed. The read path is doing work it doesn't need to In Part 3 , I swapped Spring Data R2DBC for jOOQ and added GraphQL alongside REST. The domain and application layers: zero files changed. But something bothered me about the read path. When a client calls GET /api/github-repos , here's what happens: The controller calls gitHubRepoListUseCase.execute(pageNumber, pageSize) The use case validates pagination parameters The repository queries the database The database rows are mapped into domain entities — constructing GitHubRepoId , GitHubOwner , GitHubRepoName value objects with full validation The domain entities are mapped into REST response DTOs The DTOs are se
Continue reading on Dev.to
Opens in a new tab



