DEV Community

Discussion on: Clean Architecture on Frontend

 
bespoyasov profile image
Alex Bespoyasov

DTO (data transfer object) is just a data structure, it doesn’t affect “purity”.

Layers should be decoupled, so that changes in one of them don’t affect others. DTOs are one of the ways to do that.

In the domain layer, DTOs can be the domain entities themselves. In other—specific objects designed in a way to provide only as much information as needed.

(You can find out more about this in, for example, “Domain Modeling Made Functional” and “Domain Driven Design”.)

But again, not every project needs this. Smaller apps can live without that strict separation. Every solution depends on the particular problem 😃