@nl-framework/core
v0.3.5
Published
Core runtime for the nl-framework Bun ecosystem: dependency injection, module system, configuration, lifecycle.
Maintainers
Readme
@nl-framework/core
Foundational runtime for the Nael Framework, providing dependency injection, module lifecycle management, configuration hooks, and bootstrap primitives.
Installation
bun add @nl-framework/core reflect-metadataEnable the Reflect metadata polyfill once near the process entry point:
import 'reflect-metadata';Highlights
- Modular architecture – compose applications from focused modules with predictable dependency graphs.
- Lifecycle hooks – implement
OnModuleInit/OnModuleDestroyto manage external resources safely. - Configuration ready – pair with
@nl-framework/configfor strongly typed configuration injection.
Quick start
import 'reflect-metadata';
import { Application, Module, Injectable } from '@nl-framework/core';
@Injectable()
class HelloService {
getGreeting(name: string) {
return `Hello, ${name}!`;
}
}
@Module({
providers: [HelloService],
})
class AppModule {}
const app = await Application.create(AppModule);
await app.init();
const service = app.getApplicationContext().get(HelloService);
console.log(service.getGreeting('Nael Developer'));
await app.close();License
Apache-2.0
