Bootstrap Decorator

An application should have an entry point from where it should start running. When working with the Injex framework, you can choose to define a class as the bootstrap class, and it will become the entry point for your Injex application.

Injex bootstrap class should implement the IBootstrap interface, and the Injex runtime will call the run method after all module initializations are done.


To use the @bootstrap() decorator, put it above an exported class that implements the IBootstrap interface. Please note that you should use this decorator only once in your application. Using this decorator over multiple classes will throw an error.

import { bootstrap } from "@injex/core";
export class Bootstrap implements IBootstrap {
public run(): void | Promise<void> {
console.log("bootstrap complete");
public didCatch(e: Error): void {
console.log("bootstrap error");

Notice that when decorating a class using the @bootstrap() decorator, there is no need to use the @define() method for this class.