di-framework Help

Installation

No external dependencies required! The framework works with SWC and TypeScript's native decorator support.

Requirements

  • TypeScript 5.0 or higher

  • SWC or TypeScript compiler with decorator support enabled

Install the Package

npm install di-framework

or with yarn:

yarn add di-framework

or with bun:

bun add di-framework

Configuration

TypeScript Configuration

Ensure your tsconfig.json has the following settings:

{ "compilerOptions": { "experimentalDecorators": true, "emitDecoratorMetadata": true, "target": "ES2020", "module": "ESNext", "moduleResolution": "bundler" } }

SWC Configuration

If you're using SWC, ensure your .swcrc has decorator support enabled:

{ "jsc": { "parser": { "syntax": "typescript", "decorators": true }, "transform": { "legacyDecorator": true, "decoratorMetadata": true } } }

No Additional Dependencies

The decorators are fully integrated with SWC's native support - no need for reflect-metadata or any other polyfill. This keeps your bundle size small and your dependencies minimal.

Verify Installation

Create a simple test file to verify the installation:

import { Container } from 'di-framework/decorators'; import { useContainer } from 'di-framework/container'; @Container() class TestService { getMessage() { return 'DI Framework is working!'; } } const container = useContainer(); const service = container.resolve(TestService); console.log(service.getMessage());

Run the file with your TypeScript runner (ts-node, tsx, bun, etc.):

bun run test.ts # Output: DI Framework is working!

Next Steps

Now that you have the framework installed, learn how to use it:

Last modified: 10 November 2025