ForgeKit Stable v1.0 is officially released. Upgrade now for zero-assertions DB compilation. Read Release Notes
Docs Nav

API Reference Guide

This reference documents the type declarations and class interfaces exported by the core ForgeKit engine modules.

ForgeApp class

The root entrypoint class for initializing configurations.

constructor(config?: ForgeAppConfig)

Creates a new ForgeApp application instance.

const app = new ForgeApp({ debug: true });

use<T>(plugin: ForgePlugin<T>): this

Binds a plugin layer middleware context (such as @forgekit/db) to the application instance properties.

app.use(db({ url: '...' }));

ForgePlugin interface

Plugins implementing the toolkit interface must satisfy this signature:

interface ForgePlugin<T = any> {
	name: string;
	setup(app: ForgeApp): Promise<T> | T;
	onInit?(app: ForgeApp): void;
	onBeforeRequest?(request: Request): Promise<Request | Response> | Request | Response;
	onAfterResponse?(response: Response): Promise<Response> | Response;
}