I/O is interaction with the outside world: console input and output, databases, file systems, HTTP, and other resources beyond the program. These interactions typically involve side effects and belong at the application boundary. section 15.1.1
Keep domain logic in the known world of the application. Functions can validate, transform, and pass data through the core, while boundary code receives input and produces database commands, HTTP responses, or other external effects. section 14.3.5 section 15.1.1
Treat I/O deliberately:
- Use asynchronous programming for HTTP and database calls when waiting or scalability makes synchronous communication unsuitable. section 12.1.1
- Push I/O toward the edges so the core can use pure functions for business logic and remain easier to test. section 14.3.5
- Model a web request as a flow from JSON input through validation and business logic to SQL and an HTTP response. section 15.1.1
Figure 15.1 A fictional expression chain of function calls, with separation between the impure outside and (mostly) pure inner world
Use the figure to trace how impure outside interactions surround a mostly pure chain of transformations. section 15.1.1



