A Node.js/TypeScript developer explains why they avoid DI containers like InversifyJS or Awilix in a 150K+ line codebase. Instead, they use 'Package by Component' from Clean Architecture, organizing code around use cases and actors. Dependencies are manually composed and exported via index.ts files using consistent naming conventions. The approach reduces complexity, avoids circular dependencies, eliminates decorator noise, and forces better understanding of software composition. The main tradeoff is that teams must follow the style guide consistently, which can be harder without a framework enforcing conventions.

11m read timeFrom khalilstemmler.com
Post cover image
Table of contents
Prerequisites:Building a blogStep 1: Package by componentStep 2: Create and export features from moduleUsing the Use Case FeaturesBenefits of not using a DI containerDisadvantages
1 Impression