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
| Decorator | Purpose | Reference |
|---|---|---|
@ApiController | Generates CRUD endpoints, DTOs, and Swagger metadata for an entity. | /docs/nestjs-crud-automator/api-reference/decorators/api-controller/api-controller |
@ApiControllerObservable | Marks the controller so route subscribers receive lifecycle events. | /docs/nestjs-crud-automator/api-reference/decorators/api-controller/api-controller-observable |
@ApiControllerSecurable | Enables authorization guard evaluation for all auto-generated routes. | /docs/nestjs-crud-automator/api-reference/decorators/api-controller/api-controller-securable |
Typical workflow
- Annotate a controller with
@ApiControllerand pass the entity, resource name, and per-route configuration. - Add
@ApiControllerObservablewhen route subscribers should intercept the lifecycle. - Add
@ApiControllerSecurableif authorization policies or custom guards must be enforced before CRUD actions.
Related resources
Last updated on