nestjs-best-practices

Solid

Provides comprehensive NestJS best practices including modular architecture, dependency injection scoping, exception filters, DTO validation with class-validator, and Drizzle ORM integration. Use when designing NestJS modules, implementing providers, creating exception filters, validating DTOs, or integrating Drizzle ORM within NestJS applications.

AI & Automation 263 stars 31 forks Updated 1 weeks ago MIT

Install

View on GitHub

Quality Score: 89/100

Stars 20%
81
Recency 20%
90
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# NestJS Best Practices ## Overview Grounded in the [Official NestJS Documentation](https://docs.nestjs.com/), this skill enforces modular architecture, dependency injection scoping, exception filters, DTO validation with `class-validator`, and Drizzle ORM integration patterns. ## When to Use - Designing/refactoring NestJS modules or dependency injection - Creating exception filters, validating DTOs, or integrating Drizzle ORM - Reviewing code for anti-patterns or onboarding to a NestJS codebase ## Instructions ### 1. Modular Architecture Follow strict module encapsulation. Each domain feature should be its own `@Module()`: - Export only what other modules need — keep internal providers private - Use `forwardRef()` only as a last resort for circular dependencies; prefer restructuring - Group related controllers, services, and repositories within the same module - Use a `SharedModule` for cross-cutting concerns (logging, configuration, caching) See `references/arch-module-boundaries.md` for enforcement rules. ### 2. Dependency Injection Choose the correct provider scope based on use case: | Scope | Lifecycle | Use Case | |-------------|------------------------------|---------------------------------------------| | `DEFAULT` | Singleton (shared) | Stateless services, repositories | | `REQUEST` | Per-request instance | Request-scoped data (tenant, user context) | | `TRANSIENT...

Details

Author
giuseppe-trisciuoglio
Repository
giuseppe-trisciuoglio/developer-kit
Created
7 months ago
Last Updated
1 weeks ago
Language
Python
License
MIT

Integrates with

Similar Skills

Semantically similar based on skill content — not just same category