CORE CONCEPTS
Config & Build
defineConfig() is a typed pass-through helper for your rasengan.server.ts file, read by both the CLI and bootstrap().
import { defineConfig } from '@rasenganjs/server'; export default defineConfig({ entry: 'src/main.ts', port: 4000, host: '0.0.0.0', preset: 'node', watchDir: 'src/', build: { outDir: 'dist', minify: true, formats: ['single-file'], }, });
RasenganServerConfig
BuildConfig
Resolution Order
Configuration merges from three sources, later ones winning:
- Built-in defaults (the table above).
rasengan.server.jsorrasengan.server.tsat the project root.- CLI flag overrides (
--port,--host,--entry,--preset,--watch-dir) — see CLI.
Build Output Formats
rasengan-server build bundles your server with esbuild:
single-file— everything bundled into oneserver.bundle.mjs. Simplest to deploy — copy one file.directory— one.mjsper source file, preserving your project's structure. Useful when you want to inspect or patch individual output files.
Both formats can be produced in the same build by listing both in formats.
Programmatic Overrides
bootstrap() accepts an optional second argument — a partial config that merges on top of everything else, useful for tests or embedding:
bootstrap( (app) => { app.registerModule(appModule); }, { port: 0 } ); // port 0 lets the OS assign a free port, handy in tests
Module Plugins
WebSocket Gateways
