Types & VarConfig Reference
Shorthand
"KEY": "type" validates the type only; the variable is required by default.
{
"env": [
{
"label": "web",
"path": "apps/web/.env.local",
"variables": {
"PORT": "port",
"DATABASE_URL": "url",
"API_KEY": "string"
}
}
]
}Shorthand-supported types: string, port, int, int+, float, bool, url, email, json, uuid. The pattern and enum types cannot use shorthand because they require additional fields (pattern or values).
VarConfig
For full control, use an object with a type and optional fields:
| Field | Required | Default | Notes |
|---|---|---|---|
type | yes | — | One of: string, port, int, int+, float, bool, url, enum, email, json, uuid, pattern |
optional | no | false | If true, missing value passes validation |
min | no | type-specific | string: length (default 1). int/int+/float: value range |
max | no | type-specific | string: length (default 255). int/int+/float: value range |
pattern | no | — | Regex for pattern type |
values | no | — | Allowed values for enum type |
schemes | no | ["http","https"] | URL schemes for url type |
trueValues | no | ["true","1","yes","on"] | Bool parsing |
falseValues | no | ["false","0","no","off"] | Bool parsing |
Unknown VarConfig keys cause an error (strict mode).
Types
| Type | Description |
|---|---|
string | Non-empty string. min/max = length (chars). |
port | Integer 1–65535. |
int | Any integer. |
int+ | Positive integer. min defaults to 1. |
float | Float. |
bool | Boolean. Uses trueValues/falseValues for parsing. |
url | URL. schemes restricts allowed schemes (default http/https). |
enum | One of values. Requires values array. |
email | Email address. |
json | Valid JSON. |
uuid | UUID. |
pattern | Regex match. Requires pattern field. |
Examples
Optional variable with enum:
"NODE_ENV": {
"type": "enum",
"values": ["development", "production", "test"],
"optional": true
}String with length constraints:
"APP_NAME": {
"type": "string",
"min": 1,
"max": 50
}Custom regex:
"VERSION": {
"type": "pattern",
"pattern": "^v?\\d+\\.\\d+\\.\\d+$"
}Full multi-app example:
{
"env": [
{
"label": "web",
"path": "apps/web/.env.local",
"variables": {
"PORT": "port",
"DATABASE_URL": "url",
"API_KEY": {
"type": "string",
"min": 1,
"max": 32
},
"DEBUG_MODE": "bool"
}
},
{
"label": "api",
"path": "apps/api/.env",
"required": "all",
"variables": {
"NODE_ENV": {
"type": "enum",
"values": ["development", "production", "test"],
"optional": true
},
"REDIS_URL": {
"type": "url",
"schemes": ["redis", "rediss"]
},
"RATE_LIMIT": {
"type": "int+",
"min": 1,
"max": 1000
}
}
}
]
}Last updated on