9 Building WriteFlow: The complete implementation
This chapter covers
- Assembling a complete vertical slice from domain core to REST adapter
- Applying the always-valid model, ports, handlers, and adapters as one cohesive build
- Wiring a command and a query path through the bus
- Consuming one domain event two ways through two separate listeners
- Choosing in-memory and fake adapters where infrastructure is not the lesson
- Mapping the finished application back to the ArchUnit rules and testing recipes
We’ve built WriteFlow one concern at a time. This chapter introduces no new patterns, and almost no new code. That is the point. Nearly every artifact here is one you already wrote in chapters 3 through 8, as we built WriteFlow step by step. What was missing was the whole: until now you have seen the pieces in isolation, each illustrating one idea. This chapter assembles them into a single, continuous, runnable build, from the innermost value object to the outermost HTTP response, with no gaps, and adds only the thin connective tissue (the composition root, the listeners, the controller wiring) that the full assembly demands. You will not retype the domain core or the handlers; you will watch them snap into place. If a class in this chapter surprises you, the surprise belongs to an earlier chapter; here we only connect what those chapters established.