nestjs-best-practices

Standardize and harden NestJS projects with architecture, DI, security, and performance best practices.

Updated Feb 7, 2026
One-click install
npx skills add https://github.com/adacosdev/plan-eat --skill nestjs-best-practices-adacosdev
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: nestjs-best-practices
Source: https://github.com/adacosdev/plan-eat/tree/main/.agents/skills/nestjs-best-practices
Command: npx skills add https://github.com/adacosdev/plan-eat --skill nestjs-best-practices-adacosdev

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes scripts (resource) components.

What problem does it solve?

NestJS projects often suffer from inconsistent architecture and weak pattern adoption. This skill provides a concise, opinionated, production-grade set of NestJS best practices to standardize modules, DI, error handling, security, and performance across teams.

Core Features & Use Cases

  • Modular architecture guidance: Promote feature-based modules and clear boundaries.
  • DI discipline and error handling: Enforce constructor injection, guards, pipes, and exception filters.
  • Security & performance patterns: JWT best practices, rate limiting, caching, and optimized DB queries.
  • Real-world application: Use in new projects, refactors, reviews of API modules, and microservice integration.
  • Quick governance: Helps ensure consistent code reviews and automated checks.

Quick Start

Start applying the NestJS best-practices checklist to a NestJS module or service you are building.

Frequently Asked Questions about nestjs-best-practices

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

FAQPage Schema
What are the best practices for NestJS module architecture and dependency injection?

NestJS best practices enforce feature-based modules with clear boundaries and explicit constructor injection. Applying this modular architecture ensures strict dependency injection discipline, making services easier to maintain, test, and refactor across monorepos.

How do I implement exception filters and guards in a NestJS API?

To implement exception handling in a NestJS API, apply concrete patterns like global exception filters and route guards. These mechanisms standardize error responses and secure endpoints, improving application reliability across modules.

Does this NestJS guidance apply to microservices and monorepos?

Yes, these NestJS best practices target code reviews, refactors, and new module design across monorepos and microservices. The guidance covers API, database, and testing considerations to ensure consistent architecture at scale.

How do I secure a NestJS application with JWT and rate limiting?

To secure a NestJS application, apply production-grade patterns including JWT best practices, rate limiting, and input validators. These security patterns harden API endpoints against vulnerabilities and ensure reliable access control.

What is the best way to optimize NestJS database queries and performance?

The best way to optimize NestJS performance involves applying repository patterns, caching strategies, and optimized database queries. These patterns reduce latency and improve reliability within feature modules.

How do I add health checks and testing to a NestJS module?

To add robustness to a NestJS module, implement health checks and enforce testing best practices. These patterns provide visibility into application status and ensure services remain reliable during deployment.