Environment variables, simplified.
dotenv loads configuration from a .env file into process.env. Zero dependencies. Works everywhere Node runs.
Why dotenv?
Zero dependencies
No extra packages required. Install it and start loading environment variables immediately.
Twelve-factor friendly
Keep config out of code by storing secrets and settings in a dedicated .env file.
Simple API
Call config(), parse a string, or populate a custom target object. It stays out of your way.
Battle-tested
Widely used across the Node ecosystem with predictable parsing behavior and clear documentation.
Quick start
npm install dotenv --save
require('dotenv').config()
console.log(process.env.HELLO)