Bun
Run Nitro apps with Bun runtime.
Preset: bun
Nitro output is compatible with the Bun runtime. While the default Node.js output also runs in Bun, building with the bun preset enables Bun-specific optimizations.
After building with the bun preset, start the production server with:
bun run ./.output/server/index.mjs#Environment Variables
You can customize server behavior with the following environment variables:
NITRO_PORTorPORT(defaults to3000)NITRO_HOSTorHOSTNITRO_UNIX_SOCKET- When set to a socket file path, the server listens on it instead of a TCP port, ignoringNITRO_PORT/PORTandNITRO_HOST/HOST.NITRO_SSL_CERTandNITRO_SSL_KEY- When both are set, the server launches in HTTPS mode. This is intended for testing only; in production, run the Nitro server behind a reverse proxy that terminates SSL.
NITRO_UNIX_SOCKET=./app.sock bun run ./.output/server/index.mjsYou can also set Bun-specific listener options in the server entry, for example to listen on a UNIX socket:
server.ts
export default {
bun: { unix: "./app.sock" },
fetch() {},
}; Read more in bun.sh.