Core concepts
Environment Variables
Lunadeck supports build-time environment variables that are injected during the Web Build stage.
Setting variables
You can set environment variables in two ways:
Dashboard
- Go to Project Settings > Environment Variables
- Click Add Variable
- Enter the key and value
- Choose whether the variable is available in all environments or specific ones
Configuration file
{
"env": {
"NEXT_PUBLIC_API_URL": "https://api.example.com",
"NEXT_PUBLIC_APP_VERSION": "1.2.0"
}
}Variable precedence
Variables are resolved in this order (highest to lowest priority):
- Dashboard environment variables
lunadeck.config.jsonenvfield.env.productionfile in your project.envfile in your project
Sensitive variables
Variables marked as secret in the dashboard are:
- Encrypted at rest
- Never logged in build output
- Masked in the build logs UI
- Not included in the built application bundle
Framework-specific prefixes
Most frameworks only expose variables with specific prefixes to the client:
| Framework | Required Prefix |
|---|---|
| Next.js | NEXT_PUBLIC_ |
| Vite | VITE_ |
| Nuxt | NUXT_PUBLIC_ |
| Angular | N/A (use environment.ts) |