
Research
/Security News
Miasma Mini Shai-Hulud Hits ImmobiliareLabs npm Packages
Miasma Mini Shai-Hulud hits @immobiliarelabs Backstage plugins, targeting GitLab and LDAP auth packages on npm.
@tiny-nestjs/auto-injectable
Advanced tools
AutoInjectable is a utility library designed to simplify the usage of dependency injection in Nest. It enables seamless handling of automatic injection of dependencies by the framework. With this library, you can inject dependencies into classes without the need for module definitions.
@ComponentScan() decorator enables automatic scanning and injection of classes within a module.@AutoInjectable() decorator allows classes to be automatically injectable for DI.@AutoController() decorator automatically registers controllers.npm install @tiny-nestjs/auto-injectable
1. @ComponentScan()
import { Module } from '@nestjs/common';
import { ComponentScan } from '@tiny-nestjs/auto-injectable';
@ComponentScan()
@Module({
imports: [],
controllers: [],
providers: [],
})
export class AppModule {
}
By applying the @ComponentScan() decorator to the AppModule class, Nest will automatically scan for classes and
inject necessary dependencies.
2. @AutoInjectable()
import { AutoInjectable } from '@tiny-nestjs/auto-injectable';
@AutoInjectable()
export class CatService {
// ...
}
In this case, by applying the @AutoInjectable() decorator to the CatService class, the class has become injectable,
allowing it to be injected into other modules without the need for module definitions.
3. @AutoController() and dependency injection
import { AutoController } from '@tiny-nestjs/auto-injectable';
@AutoController()
export class CatController {
constructor(private readonly catService: CatService) {
}
@Get('cats')
getCats() {
return this.catService.findAll();
}
}
The class with the @AutoInjectable() decorator has been successfully injected and /cats api can be accessed by
applying @AutoController() on CatController service.
| You can see actual project example here. |
|---|
To contribute to this library, fork the GitHub repository, make your changes, and create a pull request. Your contributions are highly appreciated. If you find any improvements or bugs, please open an issue.
@tiny-nestjs/auto-injectable is distributed under
the MIT license.
FAQs
Enables seamless DI within the Nest Framework.
The npm package @tiny-nestjs/auto-injectable receives a total of 0 weekly downloads. As such, @tiny-nestjs/auto-injectable popularity was classified as not popular.
We found that @tiny-nestjs/auto-injectable demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Miasma Mini Shai-Hulud hits @immobiliarelabs Backstage plugins, targeting GitLab and LDAP auth packages on npm.

Security News
Rolldown paused Rust React Compiler integration after a 5MB binary size increase raised concerns about shipping React-specific code to all Vite users.

Security News
/Research
Mini Shai-Hulud expands into the Go ecosystem after hitting LeoPlatform npm packages and targeting GitHub Actions workflows.