Type-safe environment variables in Bun and Node
pnpm/npm/bun i omgeving
# or
yarn add omgeving
const { PORT } = cleanEnv({ PORT: port({ devDefault: 3000 }) });
If you are using Node, you need to pass a --env-file
argument to where your .env
file is:
node --env-file=.env app.js