Menu
svelte-smol docs

Environment Variables

Runtime settings are read from the environment when the executable starts — nothing is baked in at build time.

Listening

VariableDefaultDescription
HOST0.0.0.0Listen address.
PORT3000Listen port.
SOCKET_PATHListen on a Unix socket instead of HOST/PORT.

Requests

VariableDefaultDescription
BODY_SIZE_LIMIT512KMax request body size. Accepts K/M/G suffixes.
IDLE_TIMEOUT10Socket idle timeout in seconds. Server-Sent Events responses opt out.
SHUTDOWN_TIMEOUT30Seconds to wait for in-flight requests on SIGINT/SIGTERM.

On shutdown the server emits sveltekit:shutdown on process, stops accepting connections and waits up to SHUTDOWN_TIMEOUT before forcing. A second signal forces an immediate exit.

Assets

VariableDefaultDescription
ASSETS_DIRParent directory of client/ and prerendered/ (absolute, or relative to the executable).

Proxy

See Reverse proxy for when to set these.

VariableDefaultDescription
ORIGINAbsolute origin used to build request URLs, e.g. https://my.site.
PROTOCOL_HEADERHeader carrying the forwarded protocol (e.g. x-forwarded-proto).
HOST_HEADERHeader carrying the forwarded host (e.g. x-forwarded-host).
PORT_HEADERHeader carrying the forwarded port.
ADDRESS_HEADERHeader carrying the client address (e.g. x-forwarded-for).
XFF_DEPTH1Trusted-proxy depth when ADDRESS_HEADER=x-forwarded-for.

Health check

VariableDefaultDescription
HEALTHCHECK_PATH/_healthPath the healthcheck binary probes. Must match the adapter option.
HEALTHCHECK_TIMEOUT2000healthcheck binary request timeout, in milliseconds.

envPrefix

Set the envPrefix adapter option to namespace every variable above:

adapter({ envPrefix: "MY_APP_" }); // reads MY_APP_PORT, MY_APP_HOST, …

With a prefix set, the server refuses to start if it sees a prefixed variable it doesn't know (MY_APP_PROT, say) — a typo guard, and a hint to pick a prefix that doesn't collide with your own variables.

Your app's own variables ($env/dynamic/private and friends) are never prefixed; they're passed to SvelteKit as-is.

This guide lives in the project repo: edit it there, and this page follows within a day.