API REFERENCE
defineConfig
import { defineConfig, type RasenganServerConfig, type BuildConfig, } from '@rasenganjs/server';
See Config & Build for usage and how config interacts with CLI flags — this page is the flat type reference.
defineConfig()
function defineConfig(config: RasenganServerConfig): RasenganServerConfig;
Typed pass-through helper — returns the same object you pass in, with type-checking. Used in rasengan.server.ts:
import { defineConfig } from '@rasenganjs/server'; export default defineConfig({ entry: 'src/main.ts', port: 4000, });
RasenganServerConfig
interface RasenganServerConfig { entry?: string; // default "src/main.ts" port?: number; // default 3000 host?: string; // default "0.0.0.0" preset?: 'node' | 'bun' | 'workerd'; // default "node" watchDir?: string | string[]; // default "src/" build?: BuildConfig; }
Every field the CLI accepts as a flag maps directly to one of these — see CLI for the flag-to-field table.
BuildConfig
interface BuildConfig { outDir?: string; // default "dist" minify?: boolean; // default true formats?: Array<'single-file' | 'directory'>; // default ['single-file', 'directory'] }
ConfigHolder
class ConfigHolder { static set(config: RasenganServerConfig): void; static reset(): void; static get( overrides?: Partial<RasenganServerConfig> ): Promise<Readonly<RasenganServerConfig>>; }
Static, process-wide config cache used by bootstrap() and the CLI — most apps never call this directly.
get()'s resolution order, first match wins:
- An already-cached instance (set via a prior
get()orset()call). - The
RASENGAN_SERVER_CONFIGenvironment variable, parsed as JSON. dist/config.json, if present (the production build output).rasengan.server.ts/.js, loaded from disk via the CLI's config loader.
Once resolved, the config is frozen and cached process-wide — subsequent get() calls only re-apply overrides, they don't re-resolve from scratch.
Logger
CLI
