DEV Community

Cover image for Introducing ioc-arise: a zero-decorator DI container with AST-powered auto-registration.
Sidali Assoul
Sidali Assoul

Posted on

Introducing ioc-arise: a zero-decorator DI container with AST-powered auto-registration.

I used to handle dependency inversion with Inversify, but I was constantly annoyed by two main things:

  1. You have to import the @inject decorator everywhere, which ends up polluting your domain code.
  2. Writing the boilerplate dependency binding code was so repetitive that I wished I could just type a single command — arise — and have it done automatically.

That's why I decided to create my own DI container, coupled with a command-line interface that handles code analysis (via AST parsing) and generates the registration boilerplate for you.

Some of the Features:

  • No decorators and no vendor lock-in.
  • ioc-arise supports injecting typed objects, factory functions, and classes implementing interfaces or inheriting abstract classes.
  • Multiple lifecycles: singleton and transient. The CLI can detect them if you leave a JS code comment (@scope singleton or @scope transient) just above the function or object declaration.
  • Factory functions and value objects can be detected by the CLI via a JSDoc annotation (@factory or @value).

You can find more about it here: ioc-arise

Top comments (0)