Data validation checks that values satisfy required rules before they become trusted system state. Treat every boundary as a checkpoint: client-side checks can give quick feedback, but the server must enforce critical business rules, and the domain layer should be a final defense. section 4.3.1 section 6.2.4
Put checks where they provide useful feedback and protect system integrity:
- Use database types as guardrails: store dates as dates, flags as booleans, and status codes as integers. A DATE column rejects an impossible date such as February 31; a string can preserve it until later code fails. section 8.5.2
- Validate input at each layer. A client can check email format for immediate feedback; the server decides whether that email is allowed to register. section 4.3.1 section 6.2.4
- Keep validation on write paths through required layers. Bypassing an application layer may reduce boilerplate for simple reads, but can skip rules and weaken separation of concerns. section 4.3.1
Two checks, two jobs
A client checks whether an email contains an @ symbol; the server checks whether registration is permitted. The first makes feedback fast, while the second protects the system’s rules. section 6.2.4











































