controller

Create standardized HTTP controllers for the zoppy-api project.

Updated Mar 1, 2026
One-click install
npx skills add https://github.com/Zoppy-crm/.github --skill controller-zoppy-crm
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: controller
Source: https://github.com/Zoppy-crm/.github/tree/main/skills/backend/controller
Command: npx skills add https://github.com/Zoppy-crm/.github --skill controller-zoppy-crm

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Provides a clear, organization-wide pattern for implementing HTTP controllers in the zoppy-api project so that controllers remain thin, consistent, and free of business logic while ensuring security, transaction safety, and predictable request/response contracts.

Core Features & Use Cases

  • Thin-controller pattern that delegates all business rules to Application Services and prevents leakage of domain logic into HTTP layers.
  • Standardized use of guards and decorators including BlockFreeTierGuard, RoleGuard, FeatureGuard, UsingTransaction, ExceptionInterceptor, RateLimit, and IsPublic to enforce security, feature flags, transactions, and observability.
  • Request and response DTO conventions, multipart file handling, REST URL patterns, and explicit registration of controllers in HttpModule to ensure consistent routing and integration testing readiness.

Quick Start

Create a new NestJS controller that exposes CRUD endpoints, applies BlockFreeTierGuard and RoleGuard on protected routes, uses UsingTransaction for write operations and ExceptionInterceptor for all endpoints, defines request and response DTOs, and register the controller in the HttpModule.

Frequently Asked Questions about controller

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create consistent NestJS controllers with proper guards and decorators?

To create consistent NestJS controllers, apply thin-controller patterns that delegate business logic to Application Services while using guards like RoleGuard, BlockFreeTierGuard, and decorators such as UsingTransaction and ExceptionInterceptor for security and transaction safety.

What is the thin-controller pattern and when should I use it in my HTTP API?

The thin-controller pattern keeps HTTP controllers free of business logic by delegating rules to Application Services, ensuring predictable request and response contracts while enforcing security, feature flags, and transaction safety across REST endpoints.

How do I configure rate limiting and role-based guards on REST endpoints?

Configure rate limiting and role-based access by applying the RateLimit decorator and RoleGuard to protected routes, combining them with BlockFreeTierGuard and FeatureGuard to enforce security policies and feature flags on your NestJS controllers.

Does this approach support multipart file uploads and DTO conventions in NestJS?

Yes, the pattern supports multipart file handling and defines explicit request and response DTO conventions, ensuring consistent routing and integration testing readiness when registering controllers in the HttpModule.

Why do my HTTP controllers leak domain logic and how can I prevent it?

HTTP controllers leak domain logic when business rules are written directly in endpoint handlers; preventing this requires delegating all logic to Application Services and using standardized decorators like UsingTransaction and ExceptionInterceptor to maintain separation.

When should I not put business logic inside a NestJS controller?

You should never place business logic inside a NestJS controller when following the thin-controller pattern; controllers must only handle HTTP concerns, routing, and decorator configuration while Application Services manage all domain rules and transactions.