Skip to content
EANVI

Environment variable management for Node.js

Node.js reads configuration from process.env. Teams typically load a .env file in development and inject variables from a secrets manager in production and CI.

Reading configuration in Node.js

Access variables through process.env. Validate required keys at boot so misconfiguration fails loudly.

import { z } from 'zod';

const env = z
  .object({
    DATABASE_URL: z.string().url(),
    API_KEY: z.string().min(1),
  })
  .parse(process.env);

dotenv for local loads

Libraries like dotenv load a file into process.env for local development. In production, prefer platform injection or a pull from EANVI so machines do not depend on unchecked files.

Team sync with the Eanvi CLI

Bind a project environment with eanvi init, then eanvi pull before npm run dev. CI can authenticate with an API key and pull the staging or production set as needed.

Related resources

Try EANVI

Create a workspace, import a .env, and pull secrets from the CLI.