Skip to content
Commitwise
Menu

DTO

Also called: Data transfer object

Data Transfer Object: a simple class that describes exactly what an API sends or receives.

Definition

A DTO carries data between layers or over the network, with no business logic. Using separate request and response DTOs instead of database entities keeps the API contract stable when the database changes, exposes only the fields the client needs, and gives validation annotations a natural home.

In practice

CreateBookRequest(title, author, year) is what the app sends; BookResponse(id, title, author, year) is what it gets back.

Learn it in context

Lessons that use this term.

Related terms

Esc

Type to search the whole site.