Skip to content

Configuration

The Shokupan class accepts a configuration object to customize behavior.

const app = new Shokupan({
port: 3000,
hostname: 'localhost',
development: process.env.NODE_ENV !== 'production'
});
OptionTypeDefaultDescription
portnumber3000The port the server should listen on.
hostnamestring'localhost'The hostname to bind to.
reusePortbooleanfalseAllow multiple processes to bind to the same port.
serverFactoryServerFactoryBun.serveCustom server factory (e.g., for Node.js support).
OptionTypeDefaultDescription
developmentbooleanautoEnable development mode (affects error pages, etc.).
enableAsyncLocalStoragebooleanfalseEnable AsyncLocalStorage for request-scoped globals.
controllersOnlybooleanfalseIf true, disables app.get(), app.post() etc., enforcing controller-only architecture.
OptionTypeDefaultDescription
enableTracingbooleanfalseEnable OpenTelemetry tracing integration.
enableOpenApiGenbooleantrueEnable automatic OpenAPI specification generation.
enableMiddlewareTrackingbooleanfalseTrack middleware execution for debugging (required for Debug Dashboard).
OptionTypeDefaultDescription
readTimeoutnumber30000Timeout for reading the request body (ms).
requestTimeoutnumber0 (disabled)Global timeout for processing requests (ms).

Protect your server from overload by shedding load when CPU usage is high.

OptionTypeDefaultDescription
autoBackpressureFeedbackbooleanfalseEnable automatic load shedding.
autoBackpressureLevelnumber60CPU usage % threshold to start rejecting requests with 503.