Skip to Content
DocsNestJS CRUD AutomatorAPI ReferenceDecoratorsController DecoratorsController Decorators

Controller Decorators

Controller decorators configure generated CRUD controllers, observability, and authorization guard support. Combine them to expose endpoints, emit subscriber hooks, and enable RBAC for each controller.

Available decorators

DecoratorPurposeReference
@ApiControllerGenerates CRUD endpoints, DTOs, and Swagger metadata for an entity./docs/nestjs-crud-automator/api-reference/decorators/api-controller/api-controller
@ApiControllerObservableMarks the controller so route subscribers receive lifecycle events./docs/nestjs-crud-automator/api-reference/decorators/api-controller/api-controller-observable
@ApiControllerSecurableEnables authorization guard evaluation for all auto-generated routes./docs/nestjs-crud-automator/api-reference/decorators/api-controller/api-controller-securable

Typical workflow

  1. Annotate a controller with @ApiController and pass the entity, resource name, and per-route configuration.
  2. Add @ApiControllerObservable when route subscribers should intercept the lifecycle.
  3. Add @ApiControllerSecurable if authorization policies or custom guards must be enforced before CRUD actions.
Last updated on