Skip to main content

.env Files

aixyz loads environment variables from .env files in the following order (later files take precedence):
  1. .env — Shared defaults
  2. .env.local — Local overrides (gitignored)
  3. .env.$(NODE_ENV) — e.g., .env.production
  4. .env.$(NODE_ENV).local — e.g., .env.production.local
This matches the loading order used by Next.js.
.env.local is always gitignored. Use it for API keys and secrets during development.

Common Variables

Using in Config

Reference environment variables directly in aixyz.config.ts:
aixyz.config.ts

Testing Environment

For tests, loadEnv from aixyz/test loads .env.test.local (where your OPENAI_API_KEY lives for tests). .env.local is ignored during testing:

Built-in Environment Variables

The CLI automatically sets these environment variables based on the command:

Build-Time Resolution

Environment variables referenced in aixyz.config.ts are resolved and baked into the bundle at build time. The config file itself is not included in the output — only the resolved values.