Stage 01 · Write · Researched comparison
Best TypeScript Dependency Injection Libraries in 2026
InversifyJS is the first pick for most teams that want a mature, decorator-based container with strong typing and broad framework support. Choose tsyringe if you want a lighter Microsoft-maintained container with minimal setup, or Awilix if you prefer explicit, non-decorator wiring with a functional style. All three are open source and free to use.
By Shihab Mia
Published 27 Nov 2026 · 6 tools compared
We run no ads and no affiliate links at launch. The order of a list follows our published method. See how we score.
Prices are the starting prices vendors list publicly. Plans change, so confirm the current price on the vendor page before you buy.
Key takeaways
- InversifyJS, tsyringe, TypeDI, Awilix, BottleJS and NestJS are all free and open source.
- Decorator-based libraries depend on TypeScript decorator settings and, in some cases, reflect-metadata.
- Awilix and BottleJS avoid decorators, which suits codebases that prefer explicit wiring.
- NestJS is a full framework with built-in DI, not a standalone container you add to an existing app.
Who each pick is for
- Teams wanting a mature decorator-based container with strong typingInversifyJS
- Developers wanting a small Microsoft-maintained container with simple setuptsyringe
- Projects in the TypeStack ecosystem needing decorator-based injectionTypeDI
- Teams building a full Node application with framework-provided DINestJS
- Developers who prefer explicit, non-decorator wiring and functional styleAwilix
- JavaScript-first projects that want a simple DI containerBottleJS
Comparison
| Tool | Best for | Standout feature | Listed starting price | Free plan or trial |
|---|---|---|---|---|
| 1InversifyJS | Teams wanting a mature decorator-based container with strong typing | Long-standing project with broad documentation | Free (open source) | Free plan |
| 2tsyringe | Developers wanting a small Microsoft-maintained container with simple setup | Lightweight API with minimal ceremony | Free (open source) | Free plan |
| 3TypeDI | Projects in the TypeStack ecosystem needing decorator-based injection | Simple service decorators and container API | Free (open source) | Free plan |
| 4NestJS | Teams building a full Node application with framework-provided DI | DI is built into the framework with modules and providers | Free (open source) | Free plan |
| 5Awilix | Developers who prefer explicit, non-decorator wiring and functional style | Works without decorators or reflect-metadata | Free (open source) | Free plan |
| 6BottleJS | JavaScript-first projects that want a simple DI container | Small API with no build step required | Free (open source) | Free plan |
How we picked
We picked libraries that are currently maintained, published as open source, and genuinely provide dependency injection for TypeScript or JavaScript projects. Criteria were fit for the job (decorator versus explicit wiring, typing quality, lifetime support), platform coverage (Node.js and browser), licence and price, and main limits such as compiler settings or framework coupling. Sources are vendor pages, official documentation and project repositories. Prices and licences can change, so confirm details on the vendor site before you commit.
The tools, one by one
InversifyJS
Best for teams wanting a mature decorator-based container with strong typing

What it is and where it fits
InversifyJS is a dependency injection container for TypeScript and JavaScript. You declare classes with decorators such as @injectable and bind interfaces to implementations in a container module. It supports constructor, property and method injection, plus scopes like singleton and transient. The project runs anywhere TypeScript compiles, including Node.js and browser bundles.
It is distributed under the MIT licence with no paid tier. Setup requires enabling experimentalDecorators and emitDecoratorMetadata in tsconfig, and importing reflect-metadata. Version 6 and later moved to a lighter core, but older guides may reference the v5 API, so check the current docs. Teams that dislike decorators or want zero configuration should look at Awilix or BottleJS instead.
Standout: Long-standing project with broad documentation
Free (open source), as listed by the vendor (InversifyJS website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Long-standing project with broad documentation
- supports multiple injection styles and scopes
Drawbacks
- Requires decorator and reflect-metadata configuration
- more boilerplate than minimal containers
Skip it if this limit matters to you: requires decorator and reflect-metadata configuration.
Verdict. A sensible pick for teams wanting a mature decorator-based container with strong typing.
tsyringe
Best for developers wanting a small Microsoft-maintained container with simple setup

What it is and where it fits
tsyringe is a lightweight dependency injection container from Microsoft. It uses decorators for injection and a container you register tokens against. Constructor injection is the main pattern, and it supports singleton and transient registration. It is commonly used in TypeScript Node services and in projects that want DI without a full framework.
The package is MIT licensed and free. Like other decorator-based containers, it needs experimentalDecorators and emitDecoratorMetadata plus reflect-metadata. It does not aim to match InversifyJS in scope or binding options, so complex graphs may need more manual registration. It suits small to medium services where a compact API matters more than feature depth.
Standout: Lightweight API with minimal ceremony
Free (open source), as listed by the vendor (tsyringe website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Lightweight API with minimal ceremony
- maintained under the Microsoft GitHub organization
Drawbacks
- Fewer features than larger containers
- documentation is thinner than InversifyJS
Skip it if this limit matters to you: fewer features than larger containers.
Verdict. A sensible pick for developers wanting a small Microsoft-maintained container with simple setup.
Alternatives in this guide: InversifyJS, TypeDI, NestJS
TypeDI
Best for projects in the TypeStack ecosystem needing decorator-based injection

What it is and where it fits
TypeDI is a dependency injection tool for TypeScript from the TypeStack group, the same organization behind class-validator and class-transformer. You mark classes with @Service and resolve them through the container or with @Inject. It supports singletons by default and scoped containers.
It is MIT licensed and free. It relies on decorator metadata, so the same tsconfig settings apply. Because TypeScript 5 changed decorator semantics and the ecosystem has moved toward the standard decorators proposal, confirm compatibility with your compiler version before adopting it in a new project. It fits teams already using TypeStack libraries and existing codebases that depend on it.
Standout: Simple service decorators and container API
Free (open source), as listed by the vendor (TypeDI website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Simple service decorators and container API
- fits with other TypeStack packages
Drawbacks
- Maintenance pace has slowed
- some users report issues with newer decorator proposals
Skip it if this limit matters to you: maintenance pace has slowed.
Verdict. A sensible pick for projects in the TypeStack ecosystem needing decorator-based injection.
Alternatives in this guide: InversifyJS, tsyringe, NestJS
NestJS
Best for teams building a full Node application with framework-provided DI
What it is and where it fits
NestJS is a server-side framework that includes a dependency injection system as a core feature. Providers are registered in modules and injected by constructor, with support for custom providers, factories and request-scoped instances. It runs on Node.js and can use Express or Fastify as the HTTP layer.
The framework is MIT licensed and free. It is not a drop-in container for an existing Express or Fastify app; using its DI means structuring the application around Nest modules. Teams that only need a container should choose a standalone library. Teams starting a new backend and wanting DI, modules and testing utilities in one package should evaluate NestJS as a whole.
Standout: DI is built into the framework with modules and providers
Free (open source), as listed by the vendor (NestJS website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- DI is built into the framework with modules and providers
- large documentation set
Drawbacks
- Not a standalone container
- adopting it means adopting the whole framework
Skip it if this limit matters to you: not a standalone container.
Verdict. A sensible pick for teams building a full Node application with framework-provided DI.
Alternatives in this guide: InversifyJS, tsyringe, TypeDI
Awilix
Best for developers who prefer explicit, non-decorator wiring and functional style

What it is and where it fits
Awilix is a dependency injection container for JavaScript and TypeScript that avoids decorators. You register dependencies on a container and resolve them by name, with lifetime options such as singleton, scoped and transient. It offers classic injection, where dependencies are passed as an object, and a proxy mode that resolves properties on access.
It is MIT licensed and free, and runs in Node.js and the browser. Because it does not rely on emitted metadata, it works with plain JavaScript and with TypeScript configurations that do not enable decorators. The trade-off is that wiring is string- or symbol-based, so typos surface at runtime unless you add checks. It suits teams that want explicit composition roots.
Standout: Works without decorators or reflect-metadata
Free (open source), as listed by the vendor (Awilix website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Works without decorators or reflect-metadata
- supports classic and proxy injection modes
Drawbacks
- Less type inference than decorator-based containers
- naming conventions matter
Skip it if this limit matters to you: less type inference than decorator-based containers.
Verdict. A sensible pick for developers who prefer explicit, non-decorator wiring and functional style.
Alternatives in this guide: InversifyJS, tsyringe, TypeDI
BottleJS
Best for javaScript-first projects that want a simple DI container

What it is and where it fits
BottleJS is a lightweight dependency injection micro-container for JavaScript. You register services, factories and providers on a bottle instance and retrieve them by name. It has no decorator requirement and no metadata dependency, so it works in plain scripts and bundled browser apps.
It is MIT licensed and free. TypeScript support comes through community typings rather than a first-class typed API, so type inference is weaker than in TypeScript-native containers. It suits small JavaScript projects or mixed codebases that want a minimal container. Teams that want strong typing and active TypeScript-first design should prefer InversifyJS or tsyringe.
Standout: Small API with no build step required
Free (open source), as listed by the vendor (BottleJS website). Confirm the current plan price before you buy.
Free plan. Plans change, so confirm on the vendor's pricing page before you buy.
Benefits
- Small API with no build step required
- works in browser and Node.js
Drawbacks
- JavaScript-focused with limited TypeScript typings
- not decorator-based
Skip it if this limit matters to you: javaScript-focused with limited TypeScript typings.
Verdict. A sensible pick for javaScript-first projects that want a simple DI container.
Alternatives in this guide: InversifyJS, tsyringe, TypeDI
Who should use what
If you are starting a new Node backend and want structure, NestJS gives you DI and modules together. If you have an existing TypeScript app and want a proven decorator container, InversifyJS is the safest default, with tsyringe as a lighter alternative. If your team avoids decorators, Awilix keeps wiring explicit. If you maintain a small JavaScript codebase, BottleJS covers basic needs. Match the library to your compiler settings and existing framework before adding a second container.
Questions to settle before you buy
What to check before you buy
- Confirm your tsconfig decorator and metadata settings match what the library requires.
- Check that the library supports the TypeScript version and decorator proposal you compile with.
- Verify lifetime support (singleton, transient, scoped) covers your request and background job patterns.
- Review how the container resolves circular dependencies and whether errors are clear.
- Check repository activity, open issues and last release date before adopting it long term.
FAQ
Do I need decorators to use dependency injection in TypeScript?
No. Decorator-based containers like InversifyJS, tsyringe and TypeDI use them, but Awilix and BottleJS wire dependencies explicitly without decorators. Decorators require enabling experimentalDecorators and emitDecoratorMetadata, and some libraries also need reflect-metadata imported at startup.
Is NestJS a dependency injection library?
NestJS is a full server-side framework that includes dependency injection. Its container is tied to Nest modules and providers, so it is not a drop-in library for an existing Express or Fastify app. If you only need a container, use a standalone library such as InversifyJS or tsyringe.
Are these libraries free?
Yes. All the libraries listed here are open source and free to use under permissive licences such as MIT. There are no paid tiers for the containers themselves. Costs come from your own hosting and tooling, not from the DI library.
Which library has the best TypeScript typing?
Decorator-based containers that read emitted metadata, such as InversifyJS and tsyringe, generally give strong constructor typing. Awilix and BottleJS rely more on names, so type checking is weaker. Test inference in your own code before deciding.
Can I use these in the browser?
InversifyJS, tsyringe, Awilix and BottleJS can run in browser bundles when configured correctly. Decorator-based options still need the compiler settings and metadata polyfill. For any online playground or third-party web tool, do not paste secrets, tokens or production data into the page.
Sources we checked
Method: how we score · editorial policy.
Change log. First published 27 Nov 2026.