Installation
TinyDI ships as a single package with zero runtime dependencies. Install it with your package manager of choice.
Install via npm
bash
npm install tinydi-container
The same package works with pnpm add tinydi-container, yarn add tinydi-container, or bun add tinydi-container — there is nothing npm-specific about it.
Requirements
- Runtime: Node.js, Bun, Deno, or any modern browser.
- TypeScript: 6.0 or later, if you consume TinyDI's type declarations. The compiled JavaScript output itself has no TypeScript-version requirement.
- No compiler flags to enable. TinyDI works under plain
strictTypeScript — noexperimentalDecorators, noemitDecoratorMetadata.
Nothing else to install
TinyDI has zero runtime dependencies. After installing it, npm ls tinydi-container pulls in nothing beyond the package itself.
Module format
TinyDI ships as a dual ESM/CommonJS package (built with tsup), tree-shakable, with a single entry point exporting everything you need: Container, createToken, ServiceLifetime, and the error classes.
ts
import { Container, createToken, ServiceLifetime } from 'tinydi-container';