Runtime Engines
Kiln supports two runtime server engines for serving your compiled application:
defaultEngine (Default): Uses the framework’s official production HTTP server.bun-serveEngine: Uses Bun’s native Zig-powered HTTP dispatcher for zero-copy static asset delivery at 100,000+ req/sec.
Comparison Matrix
Section titled “Comparison Matrix”| Feature | default Engine |
bun-serve Engine |
|---|---|---|
| Static Asset Performance | Standard framework speed (~15k req/s) | Native Zig speed (~100k+ req/s) |
| Time to First Byte (TTFB) | ~5-15ms | <1ms (Instant) |
| Zero-Copy Static File Transfers | ❌ (Node.js buffers) | ✅ (Bun.file kernel sendfile) |
| Dynamic SSR & Server Actions | ✅ Native | ✅ Native (proxied in-process) |
Next.js 16 proxy.ts |
✅ Intercepts all traffic | ✅ Intercepts dynamic & API traffic |
| Best For | 100% standard framework compatibility | High-traffic public web applications |
How to Select an Engine
Section titled “How to Select an Engine”Via CLI Option:
Section titled “Via CLI Option:”# Standard default enginekiln --engine default -o ./bin/app
# High-speed Bun.serve enginekiln --engine bun-serve -o ./bin/appVia Environment Variable:
Section titled “Via Environment Variable:”KILN_ENGINE=bun-serve kiln -o ./bin/appHow the bun-serve Engine Works
Section titled “How the bun-serve Engine Works”When compiled with --engine bun-serve:
┌──────────────────────────────────────────────────────────┐│ Incoming HTTP Request │└────────────────────────────┬─────────────────────────────┘ │ ▼┌──────────────────────────────────────────────────────────┐│ Bun.serve Native Zig Dispatcher │└──────────────┬────────────────────────────┬──────────────┘ │ │ Matches Static Asset in Dynamic Route, API, /_next/static/* or public/ Server Action, or proxy.ts │ │ ▼ ▼ ⚡ Instant Response Proxied In-Process to (~100,000+ req/sec) Framework Server- Tier 1 (Static
/_next/static/*assets): Served directly viaBun.filewithCache-Control: public, max-age=31536000, immutable. - Tier 2 (Public static files): Served directly via
Bun.filewith zero JS heap allocation. - Tier 3 (Dynamic SSR & APIs): Forwarded to the in-process framework server with full support for React 19 Server Actions and Next 16
proxy.ts.
