@forgekit/core
@forgekit/core is the foundational kernel that binds all toolkit modules together. It manages plugin lifecycles, configuration contexts, and middleware pipelines.
Constructor API Reference
To instantiate a ForgeKit application instance:
import { ForgeApp } from '@forgekit/core';
const app = new ForgeApp(config?: ForgeAppConfig); Config Options
| Property | Type | Default | Description |
|---|---|---|---|
debug | boolean | false | Enable detailed execution logging |
environment | 'development' \| 'production' | 'development' | Runtime node configuration state |
Plugin Middleware Pipeline
The use() method registers plugin layers (such as @forgekit/db or @forgekit/auth) and makes them available on the core app context:
import { ForgeApp } from '@forgekit/core';
import { db } from '@forgekit/db';
const app = new ForgeApp();
app.use(db({ url: 'postgres://...' }));
// The plugin adds property bindings directly
const users = await app.db.query('SELECT * FROM users'); Lifecycle Hooks
Plugins can register hooks to run at specific stages of the request/response lifecycle:
onInit: Fired when theForgeAppclass instantiates.onBeforeRequest: Runs prior to handling incoming request sessions.onAfterResponse: Executed after generating outbound responses.