juniorClean Architecture
What are DTOs (Data Transfer Objects) and why use them?
Updated Apr 28, 2026
Short answer
DTOs are simple objects used to pass data across layer boundaries without carrying any business logic.
Deep explanation
In Clean Architecture, crossing boundaries (like moving data from a Controller to a Use Case) should be done using simple data structures. DTOs prevent the inner layers from being coupled to the outer layers' data formats (like an HTTP Request object or a Database Entity).
Real-world example
A JSON object sent from a frontend that is mapped to a specific TypeScript interface before being sent to the Use Case.
Common mistakes
- Adding methods or validation logic inside a DTO.
Follow-up questions
- How do DTOs differ from Entities?