@vlandoss/envv0.5.0
contract-first environment configuration

Your env, declared
once and validated
before user code runs.

Describe every variable in a single Standard Schema contract — Zod, Valibot, ArkType. Resolve it against per-environment config files and your environment variables at boot. Missing or malformed values fail the process before user code ever reads them.

Read the docs
runtime-agnostic ·NodeBunDenoBrowsersWorkersEdge
import { schema, type Config } from "@vlandoss/env";
import * as z from "zod";

export const Env = schema({
  server: {
    HOST: z.string(),
    PORT: z.coerce.number().int().positive()
  },
  db: {
    URL: z.string()
  },
});

export type EnvConfig = Config<typeof Env>;
contract validated · 2 branches · 3 leaves
wiring resolved · process.env merged · typed env emitted
env.server.PORTnumber
01

The problem with reading env vars directly.

process.env is a string-map of unknowns. The first time you find out a value is missing is when something else crashes downstream.

01
before

.env files duplicated per environment, secrets and defaults tangled.

after

A versioned config file per environment. Secrets stay in your env vars.

02
before

process.env.PORT is a string. process.env.MISSING is undefined. Silent.

after

env.server.PORT is number. Missing values throw at boot, with the dot-path.

03
before

Locked to one validator. Locked to one runtime. Locked to one bundler.

after

Standard Schema in. Any runtime out. Opt-in adapters for Node, Vite, React.

02

Five entrypoints. Import only what you run.

The core stays portable. Filesystem, bundlers, and browser hydration live in opt-in adapters with their own peer dependencies.

Any
core
@vlandoss/env

Declare a schema. Resolve a typed env at boot.

import from"@vlandoss/env"
Node / Bun / Deno
fs
@vlandoss/env/fs

Discover & load per-environment config files from disk.

import from"@vlandoss/env/fs"
Build time
plugin
@vlandoss/env/vite

Vite plugin: alias #config, inject envName into the bundle.

import from"@vlandoss/env/vite"
SSR / SSG
react
@vlandoss/env/react

<EnvScript /> ships the server-resolved env to the browser.

import from"@vlandoss/env/react"
Any
zod
@vlandoss/env/zod

Opinionated Zod primitives: port, host, bool, secret…

import from"@vlandoss/env/zod"
works with any Standard Schema validator
ZodValibotArkTypeStandard Schema
03

No mapping ceremony. Just dot-path → SCREAMING_SNAKE.

camelCase keys are converted automatically. Override the rare exception with a one-line entry in vars.

schema pathenv var
server.PORTSERVER_PORT
db.URLDB_URL
sessionCookie.PREFIXSESSION_COOKIE_PREFIX
db.kit.LOGGINGDB_KIT_LOGGING
PORTPORT
override
defineEnv({
  schema: Env,
  vars: {
    db: { URL: "DATABASE_URL" },
    public: {
      $: null,                   // flat branch
      APP_NAME: "PUBLIC_APP_NAME"
    },
  },
});

One schema for every environment,
validated at boot.

MIT licensed·made atVariable Land·v0.5.0·2026