sb-nestjs

Installation
SKILL.md

Sunbytes Nest.js

When to apply

Trigger on Nest.js projects (@nestjs/* imports, nest-cli.json, *.module.ts files, decorators like @Controller, @Injectable, @Module). Always load sb-typescript alongside.

Module organisation

  • One module per bounded context (UsersModule, BillingModule, NotificationsModule), not per technical layer (ServicesModule, ControllersModule — never).
  • Module file co-located with its controller, services, and DTOs. Folder = module.
  • The module's public API is what the module file exports. Nothing else should be imported across module boundaries — enforce with ESLint no-restricted-imports if needed.
  • Cross-module communication via injected interfaces or events, not direct service-to-service imports across contexts.

Dependency injection

  • Constructor injection only. No property injection (@Inject() on fields).
  • Class providers by default. useFactory only when construction needs runtime config.
  • @Injectable({ scope: Scope.DEFAULT }) (singleton) — avoid Scope.REQUEST unless you've measured a real need. It disables caching and tanks throughput.
  • Depend on interfaces (abstract classes), not concrete services, for things that cross context boundaries (repositories, external clients). Bind the interface to the implementation in the module's providers.
Installs
7
First Seen
Jun 5, 2026