API reference
Core
Exports from the @vlandoss/env entrypoint — the runtime-agnostic core where schemas are declared, env is resolved, and the current environment name is detected.
The @vlandoss/env entrypoint is the only one you always import — it contains the runtime-agnostic core. Adapter entrypoints (/node, /vite, /react, /zod) build on top of it.
Exports
| Export | Kind | Summary |
|---|---|---|
schema | Function | Declare the contract — branches and Standard Schema leaves. |
defineEnv | Function | Merge config + environment variables, validate, and return a typed env object. |
envName | Function | Detect the current environment name across runtimes — development, production, … |
readEnv | Function | Read raw values from the active source (process.env on the server, window.__env in the browser). Returns {} on runtimes without process (Workers) — pass runtimeEnv to defineEnv instead. |
Config | Type | The input shape of per-environment config files for a given schema. |
Env | Type | The output shape of the resolved env object for a given schema. |
Full signatures and option tables are coming soon. Until then, see Concepts → Overview for the mental model and Quickstart for a runnable example.
See also
- Concepts → Resolution order — how
defineEnvmerges sources. - Concepts → Env-var naming — how schema paths map to env-var names.
- Concepts →
envName()— precedence and the Vite gotcha.