Environment variables

For the most part, Rakkas handles environment variables the same way as Vite. import.meta.env will be expanded in build-time. Variables starting with VITE_ will be exposed to client-side code while the rest will only be exposed to server-side code.

Runtime environment variables can be accessed using process.env on the server-side. If your deployment target is cloudflare-workers, there's a shim in the runtime code that exposes all ALL_CAPS global variables with a string value in the process.env object to help with portability.

If you need to access runtime environment variables in client code, you should expose them yourself, e.g., using rootContext or API routes.

Configuration through environment variables

If you're deployment target is node, the generated server supports the following environment variables:

VariableDescription
TRUST_FORWARDED_ORIGINWhether to trust x-forwarded-* headers
HOSTServer host
PORTHTTP port