nestjs-interceptors

Generate NestJS interceptors for logging, responses, errors, timeouts, caching, and metrics.

3|Updated Mar 18, 2026
One-click install
npx skills add https://github.com/diegoleteliers10/nestjs-interceptors-skill --skill nestjs-interceptors
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nestjs-interceptors
Source: https://github.com/diegoleteliers10/nestjs-interceptors-skill/tree/main/skill
Command: npx skills add https://github.com/diegoleteliers10/nestjs-interceptors-skill --skill nestjs-interceptors

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Este skill ayuda a crear interceptors NestJS profesionales y limpios que gestionan el logging, la transformación de respuestas, el formato de errores, timeout, caching y métricas, facilitando una capa de observabilidad y robustez para APIs NestJS.

Core Features & Use Cases

  • Logging robusto con un sistema de wide events para trazabilidad; - Transform Interceptor para respuestas estandarizadas; - Error Format para consistente devolver errores estructurados; - Timeout para gestionar requests lentos; - Cache para respuestas repetidas; - Metrics para medir rendimiento; - Integración fácil en InterceptorsModule y uso global. Use cases include: añadir logging al API, estandarizar respuestas, gestionar errores y añadir métricas.

Quick Start

Enable the InterceptorsModule globally and configure the desired interceptors in AppModule.

Frequently Asked Questions about nestjs-interceptors

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

FAQPage Schema
How do I standardize API responses and error formats in NestJS?

Standardizing API responses in NestJS is achieved by applying a transform interceptor for uniform payloads and an error format interceptor for structured exceptions. This ensures consistent output formats for successful requests and predictable error objects across all endpoints.

What is the best way to implement robust logging and metrics in a NestJS application?

Robust logging and metrics in a NestJS application are implemented using interceptors that generate wide events for tracing and measure performance visibility. This approach provides a comprehensive observability layer for backend APIs. The interceptors automatically capture request details for logging and track execution metrics.

How do I set up a request timeout interceptor in NestJS?

Setting up a request timeout interceptor in NestJS cancels slow requests to prevent resource exhaustion. The timeout interceptor is one of six configurable options available within a global InterceptorsModule. You can selectively activate it through a simple configuration to enforce maximum execution times for your API endpoints.

Can I selectively enable caching and logging interceptors globally in NestJS?

You can selectively enable caching and logging interceptors globally in NestJS by configuring the InterceptorsModule within your AppModule. This module allows simple configuration to activate any of the six available interceptors, including caching for repeated responses and logging for wide event tracing, without modifying individual controllers.

Does this interceptor module work without external dependencies in NestJS?

The interceptor module works without external dependencies in NestJS, relying solely on the framework's built-in interceptor capabilities. It provides six configurable interceptors for logging, transformation, error formatting, timeout, caching, and metrics. You only need to integrate the module globally and specify which interceptors to activate.

Why should I use interceptors for API observability instead of middleware in NestJS?

Using interceptors for API observability instead of middleware in NestJS provides access to both the request and response context, enabling response transformation and performance metrics. Interceptors allow standardizing API response formats, managing timeouts, and implementing wide event logging globally. Middleware lacks the ability to modify response data or measure execution time accurately.