Skip to content

Configuration options

PropertyTypeDefaultDescription
rootstringNoneBase for relative paths. Required for programmatic use and set automatically by the CLI
publicstring"../public/main"Static file directory, as an absolute path or relative to root
apistring"/api"Path where the HTTP API is mounted
portnumber3000Integer from 0 to 65535. With 0, the OS assigns an available port
middlewaresexpress.RequestHandler[][]Express middleware added before APIs and static file serving
lanbooleanfalseListens on 0.0.0.0 when true, or 127.0.0.1 when false
qrbooleanfalseDisplays a QR code for the network URL in the terminal
browserboolean | "local" | "lan"falseURL to open after startup. true is the same as "local"
autoPortbooleanfalseIncrements the port until an available one is found when the requested port is in use
signalClosebooleantrueRuns shutdown handling on SIGINT / SIGTERM
languagestring"ja-JP"Language for server and CLI messages

browser

ValueBehavior
falseDoes not open a browser
trueOpens the local URL
"local"Opens the local URL
"lan"Opens the network URL when lan: true; otherwise warns and opens the local URL

autoPort

When the requested port is in use and autoPort: true, the server increments the port number until one is available. When it is false, the CLI asks whether to use the next port and startup fails if you decline.

After startup, getPort() returns the port that is actually in use.

Validation

defineConfig() validates the configuration with a Zod schema and throws a ZodError for an invalid type, range, or unknown property. Unknown properties are also TypeScript errors.