# @n8n/di

Latest version **0.17.0** (published 2026-09-15) · SEE LICENSE IN LICENSE.md license · 0 weekly downloads

## Install

```sh
npm install @n8n/di
pnpm add @n8n/di
yarn add @n8n/di
bun add @n8n/di
```

## Health

**Score 85/100 (A)** — status: active.

Positive: has types; esm support; no vulnerabilities; has provenance; recently updated; high maintenance score; high quality score; popular repo; extremely popular.

Warnings: low downloads; pre 1.0.

## Facts

| | |
|---|---|
| Version | 0.17.0 |
| Published | 2026-09-15 |
| First published | 2025-01-08 |
| Weekly downloads | 0 |
| License | SEE LICENSE IN LICENSE.md |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 77.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 206238 |
| Author | Jan Oberhauser |
| Maintainers | cornelius_n8n_io, n8n-matsuuu, tomin8n, jan_n8n_io, n8n-charliekolb |

## Links

- npm: https://www.npmjs.com/package/@n8n/di
- Repository: https://github.com/n8n-io/n8n
- Homepage: https://n8n.io
- npm.io page: https://npm.io/package/@n8n/di

## Dependencies (1)

- [reflect-metadata](https://npm.io/package/reflect-metadata.md) 0.2.2

## Recent versions

- 0.17.0 (latest) — 2026-09-15
- 0.9.0 (rc) — 2025-07-28
- 0.16.0 — 2026-07-21
- 0.15.0 — 2026-07-14
- 0.14.0 — 2026-06-16
- 0.13.0 — 2026-06-09
- 0.12.0 — 2026-05-19
- 0.11.0 — 2026-04-28
- 0.10.0 — 2025-11-24
- 0.8.0 — 2025-07-07
- 0.7.0 — 2025-06-30
- 0.6.0 — 2025-06-02
- 0.5.0 — 2025-04-22
- 0.4.0 — 2025-03-03
- 0.3.0 — 2025-01-15
- … 1 more at https://npm.io/package/@n8n/di/versions

## README

## @n8n/di

`@n8n/di` is a dependency injection (DI) container library, based on [`typedi`](https://github.com/typestack/typedi).

n8n no longer uses `typedi` because:

- `typedi` is no longer officially maintained
- Need for future-proofing, e.g. stage-3 decorators
- Small enough that it is worth the maintenance burden
- Easier to customize, e.g. to simplify unit tests

### Usage

```typescript
// from https://github.com/typestack/typedi/blob/develop/README.md
import { Container, Service } from 'typedi';

@Service()
class ExampleInjectedService {
  printMessage() {
    console.log('I am alive!');
  }
}

@Service()
class ExampleService {
  constructor(
    // because we annotated ExampleInjectedService with the @Service()
    // decorator TypeDI will automatically inject an instance of
    // ExampleInjectedService here when the ExampleService class is requested
    // from TypeDI.
    public injectedService: ExampleInjectedService
  ) {}
}

const serviceInstance = Container.get(ExampleService);
// we request an instance of ExampleService from TypeDI

serviceInstance.injectedService.printMessage();
// logs "I am alive!" to the console
```

Requires enabling these flags in `tsconfig.json`:

```json
{
  "compilerOptions": {
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true
  }
}
```

---
_Source: https://npm.io/package/@n8n/di · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
