Can someone suggest a simple dependency injection library for TypeScript/JavaScript?

This page summarizes the projects mentioned and recommended in the original post on /r/typescript

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • tsyringe

    Lightweight dependency injection container for JavaScript/TypeScript

    Coming from a mostly Java background and using Spring often I was curious to try out DI in node on a personal project. I found tsyringe made by Microsoft to be pretty easy to use https://github.com/microsoft/tsyringe

  • koin

    Koin - a pragmatic lightweight dependency injection framework for Kotlin & Kotlin Multiplatform

    I've been using Angular a lot and I like how it works. I'm also a huge fan of koin for kotlin.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

  • awilix

    Extremely powerful Inversion of Control (IoC) container for Node.JS

    I used awilix in several project, seems good enough for us, no problem so far. https://github.com/jeffijoe/awilix

  • diod

    A very opinionated inversion of control (IoC) container and dependency injector for Typescript, Node.js or browser apps.

    I will suggest DIOD https://github.com/artberri/diod which is specially designed for Typescript, although it can be used with vanilla JS also.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts