Concern
Controller layer: HTTP endpoints and request/response handling.
Technology
NestJS controllers
Documentation
- Website: https://docs.nestjs.com/controllers
- Repository: https://github.com/nestjs/nest
- Getting started: https://docs.nestjs.com/first-steps
Implementation
All HTTP responses are normalized in backend/src/app.module.ts. The app registers three global exception filters with APP_FILTER: AllExceptionsFilter (catch-all for unknown errors, returns 500 envelope), HttpExceptionFilter (Nest HTTP exceptions → shared envelope), and ZodExceptionFilter (validation errors from ZodValidationPipe → client-error envelope with fieldErrors). Nest runs filters in reverse registration order, so the specific filters run first and the catch-all handles the rest. The ResponseInterceptor is registered with APP_INTERCEPTOR and wraps successful handler return values as { statusCode, data }. Controllers therefore return domain data only; they do not manually wrap responses. The default AppController from nest new remains; add new controllers and inject services as usual.
Integration
framework / NestJS
Controllers are part of the NestJS framework. Call service-layer for business logic. All HTTP responses are normalized to the contract in patterns responses via a response interceptor (success) and a global exception filter (errors).