Simple dependency injection for Typescript modules.
Last updated 3 months ago by lamnhan .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install @lamnhan/seminjecto 
SYNC missed versions from official npm registry.


Simple dependency injection for Typescript modules.

License Support me on Patreon PayPal Ask me anything


Dependency injection is a common method for structuring modules. It is native in frontend frameworks like Angular and can be used for any JS modules in the same manner using library like InversifyJS, tsyringe, ...

But you can also manually apply DI to any module using this simple method. There is a central class (Main for library, Cli for cli app, App for app, ...) that acts as a DI container and injector.

// the service 1
export class Service1Service {}

// the service 2 is depends on the service 1
export class Service2Service {
  constructor(private service1Service: Service1Service) {}

// the container for all services and also the injetor
export class Main {
  service1Service: Service1Service;
  service2Service: Service2Service;

  constructor() {
    this.service1Service = new Service1Service();
    this.service2Service = new Service2Service(
      this.service1Service // injects the service 1



Install as glocal CLI app.

npm install -g @lamnhan/seminjecto


These skeletons can be use to faster setup a project. You can either clone them manually or using the command semidi new <name>:

  • Library: For any normal library.
  • CLI: For building a Node CLI app.

Command overview

Simple dependency injection for Typescript modules.

Command reference


Generate a resource.


  • <type>: The resource type
  • <dest>: The resource destination


Create a new project.


  • <name>: The project name
  • [description]: The project description


  • -x, --cli: Create a CLI project.


Display help.


@lamnhan/seminjecto is released under the MIT license.

⚡️ This document is generated automatically using @lamnhan/ayedocs.

Current Tags

  • 1.0.0-beta2                                ...           latest (3 months ago)

2 Versions

  • 1.0.0-beta2                                ...           3 months ago
  • 0.0.1                                ...           6 months ago
Maintainers (1)
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (6)
Dev Dependencies (12)
Dependents (0)

Copyright 2014 - 2016 © taobao.org |