Skip to Content
Env ValidationTypes & Reference

Types & VarConfig Reference

Shorthand

"KEY": "type" validates the type only; the variable is required by default.

>miso.json
{ "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.

type

Required. One of: string, port, int, int+, float, bool, url, enum, email, json, uuid, pattern.

optional

Defaults to false. If true, a missing value passes validation — only present values are type-checked.

min / max

Type-specific range constraints:

  • string — character length. min defaults to 1, max defaults to 255.
  • int / int+ / float — numeric value range.

pattern

A regex string used by the pattern type. Required when type is "pattern".

>miso.json
{ "VERSION": { "type": "pattern", "pattern": "^v?\\d+\\.\\d+\\.\\d+$" } }

values

An array of allowed strings for the enum type. Required when type is "enum".

>miso.json
{ "NODE_ENV": { "type": "enum", "values": ["development", "production", "test"], "optional": true } }

schemes

An array of allowed URL schemes for the url type. Defaults to ["http", "https"].

>miso.json
{ "REDIS_URL": { "type": "url", "schemes": ["redis", "rediss"] } }

trueValues / falseValues

Arrays of strings used to parse bool values. Defaults:

  • trueValues: ["true", "1", "yes", "on"]
  • falseValues: ["false", "0", "no", "off"]

Unknown VarConfig keys cause an error (strict mode).

Types

TypeDescription
stringNon-empty string. min/max = length (chars).
portInteger 1–65535.
intAny integer.
int+Positive integer. min defaults to 1.
floatFloat.
boolBoolean. Uses trueValues/falseValues for parsing.
urlURL. schemes restricts allowed schemes (default http/https).
enumOne of values. Requires values array.
emailEmail address.
jsonValid JSON.
uuidUUID.
patternRegex match. Requires pattern field.

Basic Example

>miso.json
{ "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