@vlandoss/env
v0.3.0
Published
Contract-first environment configuration with typed schemas
Downloads
2,218
Maintainers
Readme
@vlandoss/env
🌱 Contract-first environment configuration with typed schemas. Define your env once with Standard Schema (Zod, Valibot, ArkType…), get a fully typed env object that merges per-environment config with your environment variables.
Runtime-agnostic core — Node, Bun, Deno, browser, Workers, Edge. Opt-in entry points: a filesystem-based config loader (works on Node, Bun, and Deno), a Vite plugin, a React <EnvScript /> helper for hydrating runtime env across SSR or CSR, and a curated set of Zod-based schema primitives.
Installation
pnpm add @vlandoss/env@vlandoss/env is agnostic to the schema validator. If you'll use Zod (the docs default, and the validator behind the optional @vlandoss/env/zod primitives), install it alongside:
pnpm add zodDocumentation
- Getting started
- Concepts — mental model, resolution order, env-var naming
- Guides — recipes for Node, SPA, SSR
- API reference
Examples
Runnable apps under examples/:
backend-node— Node server withloadConfigbackend-bun— Bun server withloadConfigbackend-deno— Deno server withloadConfigworker-cloudflare— Cloudflare Worker,runtimeEnv: c.envper-requestedge-nextjs— Next.js App Router route handler withruntime: 'edge'spa-vite-dynamic— SPA, dynamic import patternspa-vite-plugin— SPA,#configaliasssr-react-router— SSR with React Router 7ssr-tanstack-start— SSR with TanStack Start
License
MIT
