backend

Standardize NestJS backend modules, controllers, services, and DTOs for RedisInsight API.

8.7k|482|Updated Jul 30, 2021
One-click install
npx skills add https://github.com/redis/RedisInsight --skill backend-redis
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: backend
Source: https://github.com/redis/RedisInsight/tree/main/.ai/skills/backend
Command: npx skills add https://github.com/redis/RedisInsight --skill backend-redis

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It solves the problem of inconsistent, error-prone backend implementation when building RedisInsight’s NestJS API, helping developers ship maintainable modules with validation, clear layering, and predictable error handling.

Core Features & Use Cases

  • Modular NestJS architecture: feature-based modules with controllers, services, and DTOs to keep responsibilities separated and scalable.
  • DTO validation and Swagger-ready contracts: use class-validator decorators and Swagger annotations to enforce input quality and document endpoints.
  • Consistent error handling patterns: apply NestJS HTTP exceptions and prefer custom exceptions with stable error structures for frontend handling.
  • Clean dependency injection and service design: inject TypeORM repositories and other services via constructors, keeping business logic out of controllers.
  • Redis integration guidance: follow a Redis client/service pattern with graceful error handling and logging for Redis operations.

Quick Start

Ask the AI to generate a new NestJS feature module for redisinsight/api that includes a module file, controller with Swagger decorators, service with dependency injection, DTOs with validation, and a custom exception for not-found errors.

Frequently Asked Questions about backend

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

FAQPage Schema
How do I structure a NestJS module with controllers, services, and DTOs?

NestJS module structure separates responsibilities using feature-based modules with controllers for routing, services for business logic, and DTOs for validation. This pattern keeps your API scalable and maintainable by injecting dependencies via constructors.

How do I validate API request data in NestJS using class-validator?

Class-validator validates API request data in NestJS by applying validation decorators to DTO classes. This enforces input quality at the boundary layer before data reaches your service logic, ensuring predictable API behavior.

What is the best way to handle API errors in NestJS?

The best way to handle API errors in NestJS is applying standard HTTP exceptions alongside custom exceptions with stable error structures. This pattern ensures consistent error handling and predictable frontend integration when API operations fail.

How do I generate Swagger documentation for NestJS API endpoints?

Swagger documentation for NestJS API endpoints is generated by adding Swagger annotations to your controllers and DTOs. This automatically produces API contracts that document input validation rules and response structures.

Can I use TypeORM repositories with NestJS dependency injection?

TypeORM repositories work with NestJS dependency injection by injecting them via constructors into your services. This keeps business logic out of controllers and maintains clean separation between data access and routing layers.

How do I integrate Redis operations into a NestJS service?

Redis operations integrate into NestJS services using a Redis client and service pattern with graceful error handling and logging. This ensures Redis operations fail safely without crashing your API application.