dotenv
github.com
2
Leaving SiteNav
External Link Disclaimer
You are about to visit github.com. This website is not operated by us. We are not responsible for its content or privacy practices.
About this website
dotenv is a zero-dependency Node.js module that loads environment variables from a .env file into process.env, making it easy to manage application configuration without hardcoding sensitive information like API keys, database credentials, and feature flags in source code. Created by Scott Motte (motdotla), it has become the most widely-used environment configuration tool in the Node.js ecosystem, with over 3 million weekly npm downloads and adoption by virtually every major Node.js framework and application. The library follows the twelve-factor app methodology, which recommends storing configuration in the environment for maximum portability between development, staging, and production environments. The core functionality is simple: dotenv reads a .env file from the project root directory (or a custom path), parses each line as a KEY=value pair, and sets these as environment variables accessible via process.env in the Node.js process. Key features include: automatic parsing and loading of .env files with support for single and double-quoted string values, multiline values, variable expansion (referencing other environment variables using the dollar sign syntax), comment support (lines starting with hash), support for boolean, number, and JSON value types, multiline string support, support for loading multiple .env files (e.g., .env.local overriding .env, .env.development, .env.production), built-in support for Next.js and Vite convention .env files, preloading via the node -r dotenv/config or node --env-file flags, TypeScript support with type definitions, and a dotenv-cli command-line tool for running commands with .env variables loaded. The library has evolved from v15 to v17 (as of 2026), with each major version adding features while maintaining backward compatibility.
Statistics
2
Views
0
Clicks
0
Like
0
Dislike