CodeZettaInterview Hub

NestJS · DTOs · Fresh / Intern · Concept

What is a DTO in Nest and why separate from entities?

Short Interview Answer

Data Transfer Objects define API shapes; entities model persistence — decoupling prevents leaking DB schema.

Detailed Explanation

Request and response DTOs can differ. Validation decorators live on DTOs. Never expose entities blindly.

Did you know this answer?