API REFERENCE
ServerApp
import { ServerApp, bootstrap } from '@rasenganjs/server';
Core application class — orchestrates module registration, middleware layering, dependency injection, validation, and compilation into a runtime Futon. Normally configured through bootstrap()'s callback rather than constructed directly.
Modules & Plugins
Middleware
Error / 404 Handlers
WebSockets
Validation
configureValidation(config: Partial<ValidationConfig>): void
Sets the schema adapter and/or default error handler. Defaults to zodAdapter + a 400 JSON error handler.
App Lifecycle
Compilation
compile(): Futon getBuildSummary(): BuildSummary | null close(): Promise<void>
compile() flattens the module tree, registers providers with module-scoped visibility, registers every controller's routes with the correct middleware nesting, and returns the resulting Futon. Called internally by bootstrap() — you don't normally call it yourself.
interface BuildSummary { modules: ModuleSummary[]; durationMs: number; } interface ModuleSummary { name: string; prefix?: string; routes: Array<{ method: string; path: string }>; providers: string[]; pluginGroups: Record<string, string[]>; // keyed by plugin extension key, e.g. "gateways" middlewareCount: number; }
bootstrap()
function bootstrap( callback: (app: ServerApp) => void | Promise<void>, overrides?: Partial<RasenganServerConfig> ): Promise<ServerHandle>; interface ServerHandle { close(): void; app: ServerApp; }
The recommended entry point — creates a ServerApp, loads config, runs your callback, compiles, then selects and starts the matching runtime adapter. Returns a handle for programmatic shutdown.
