dependency-injection
NestJS Dependency Injection
When to Use This Skill
Use this skill when:
- Working with custom providers beyond standard class providers
- Using factory providers for dynamic or async initialization
- Implementing value providers for configuration or constants
- Creating alias providers with useExisting
- Working with non-class-based injection tokens (strings or symbols)
- Implementing async providers that require initialization
- Understanding the three-step provider registration process
- Configuring provider scopes beyond singleton
What is Dependency Injection?
Dependency Injection (DI) is an inversion of control pattern where dependencies are provided to a class rather than the class creating them itself. NestJS has a built-in IoC (Inversion of Control) container that manages the entire DI system.
Three-Step Provider Registration
More from ramziddin/ccplugins
security
NestJS security best practices including CORS, CSRF protection, Helmet for HTTP headers, rate limiting, encryption, and hashing. Use when implementing security features, hardening applications, or protecting against common vulnerabilities.
3authentication
NestJS authentication with JWT, Passport, local/JWT strategies, and auth guards. Use when implementing user login, token generation, protected routes, or integrating authentication systems.
3caching
NestJS caching with cache module, in-memory caching, Redis integration, cache interceptor, and TTL management. Use when implementing performance optimization, reducing database queries, or storing temporary data.
2exception-filters
NestJS exception filters for handling errors, customizing error responses, logging exceptions, and providing consistent error formatting across your application.
2cli
NestJS CLI for generating resources, managing workspaces, building applications, and development commands. Use when scaffolding NestJS projects, generating boilerplate code, or managing monorepo structures.
2testing
NestJS unit and E2E testing with Test.createTestingModule(), mocking dependencies, testing best practices, and integration testing strategies. Use when writing tests for controllers, services, or full application flows.
2