Interface as Tokens
Native support for useInterface
Zero-overhead dependency injection that shifts resolution from Runtime to Build-Time. No reflection, no decorators, just pure TypeScript.

Traditional DI containers like InversifyJS and tsyringe rely on runtime resolution:
NeoSyringe is different. It works as a compiler plugin:
// Pure TypeScript - no decorators!
interface ILogger {
log(msg: string): void;
}
class ConsoleLogger implements ILogger {
log(msg: string) { console.log(msg); }
}
class UserService {
constructor(private logger: ILogger) {}
}
// Configure the container
import { defineBuilderConfig, useInterface } from '@djodjonx/neosyringe';
export const container = defineBuilderConfig({
name: 'AppContainer',
injections: [
{ token: useInterface<ILogger>(), provider: ConsoleLogger },
{ token: UserService }
]
});
// Use it with full type safety
const userService = container.resolve(UserService);
// Type: UserService ✅ - Full auto-completion!Zero DI library shipped to production! The build plugin replaces your defineBuilderConfig(...) with an optimized container class — no runtime overhead, no reflection, no magic.