Skip to main content

Build HTTP APIs
with Dependency Injection

A powerful set of tools to create HTTP APIs on top of InversifyJS

Dependency Injectiontypescript
@injectable()
export class AuthMiddleware implements ExpressMiddleware {
constructor(
@inject(UserTokenService)
private readonly userTokenService: UserTokenService,
) {}

public execute(
request: Request,
_response: Response,
next: NextFunction,
): void {
this.userTokenService.extractUserInfo(request);
next();
}
}
Server Setuptypescript
const container: Container = new Container();
const app: express.Application = await new InversifyExpressHttpAdapter(
container,
{
logger: true,
useCookies: true,
},
).build();

app.listen();
RESTful Controllerstypescript
@Controller('/messages')
export class MessagesController {
@Get('/hello')
public async sayHello(): Promise<Message> {
return { content: 'world' };
}
}

Why Choose InversifyJS HTTP?

🚀

Lightning Fast

Minimal overhead with maximum performance. Built for production-scale applications.

🔧

Strongly Typed

Full TypeScript support with compile-time safety and excellent IDE integration.

🎯

Decorator-Driven

Clean, expressive APIs using decorators for routes, middleware, and dependency injection.

🌐

Framework Agnostic

Works seamlessly with Express, Fastify, or any Node.js HTTP framework.

🔌

Highly Extensible

Plugin system and middleware support for unlimited customization possibilities.

📚

Battle Tested

Used in production by thousands of developers worldwide with comprehensive documentation.

Sponsors

We are incredibly grateful for the support of our sponsors. Every contribution helps us maintain and improve InversifyJS.