Lesson 28 / 33
Best Practices
Patterns and conventions for maintainable, scalable code.
Folder structure & naming
One feature per folder; consistent naming (*.controller.ts, *.service.ts, *.module.ts); group by domain, not by type.
DTOs & validation
Always use DTOs for input validation; separate create/update DTOs; validate at the boundary (controller).
Error handling uniformity
Throw HTTP exceptions with clear messages; use a global filter to format responses consistently.