dotenv
Reasonable, with limits. 5th of 9 config and environment variables.
dotenv is the long-standing, zero-dependency loader that reads a .env file into process.env. It is stable, safe and used everywhere, but it only loads values and does not check them. Node's built-in --env-file and process.loadEnvFile() now cover the basic case, and two major versions in about 15 months, including a period of default promotional log lines, have cost it some goodwill.
Best for: Node projects that need a small, proven .env loader with expansion-friendly parsing, on runtimes or tools where Node's built-in --env-file is not an option.
Scores
Overall6.8
How strongly do we recommend it for a new project today?
Claude Opus 5.5: 6.5, likely 5.5 to 7.5
It is a safe, proven loader that will not hurt a project, but for new work it is rarely the best pick. Node's native --env-file or the framework's own loader covers basic loading, and a validator such as T3 Env or envalid is needed to check values anyway. Recent churn in defaults and major versions also lowers it a little.
- stefanjudis.com/blog/load-env-files-in-node-js-scripts: process.loadEnvFile replaces dotenv.config()
- peers: T3 Env, Varlock and dotenvx are growing faster and add validation or encryption
- dotenvx.com/blog/2026/09/19/dotenv-18.html: v18 breaking changes
GPT-6.2 Sol: 7.1, likely 5.9 to 8.2
Dotenv is a strong pick when a project benefits from its file precedence, override rules, or consistent parsing across Node versions. For basic loading on modern Node, the built-in loader usually suffices. For startup validation, envalid or T3 Env covers more of the job. Active releases and downstream support keep dotenv viable, while slower relative growth limits confidence in it as a default for new projects.
- github.com/motdotla/dotenv/blob/v18.0.10/README.md: Documents the loading controls that justify the dependency.
- nodejs.org/api/environment_variables.html: Node supplies a built-in option for basic loading.
- github.com/af/envalid: Provides startup validation and typed values.
- github.com/t3-oss/t3-env: Provides schema-based environment validation.
- npm versionsLastYear, npm downloadsLast4Weeks, npm downloadsSame4WeeksYearAgo, medianDownloadsRatio: Frequent publishing alongside below-median download growth.
Needed by many6.9
How many developers need a tool for this job?
Claude Opus 5.5: 7.5, likely 6.5 to 8.5
Most Node backends and scripts need to load settings from a .env file during development, so the job is very common. Built-in loading in Node, Bun, Deno and the frontend frameworks makes the need for this package smaller than the need for the job. It also covers only loading, not the checking half of the category.
- pawelgrzybek.com/node-js-with-native-support-for-env-files-you-may-not-need-dotenv-anymore: Node's native --env-file removes the need for dotenv in many cases
- dependents: 1.23M dependent repos show the job is nearly universal
GPT-6.2 Sol: 6.3, likely 5.1 to 7.5
Loading settings from files is common in Node.js apps, scripts, and command-line tools. The package covers file loading and parsing, and many projects already get that from their runtime or framework. The developer survey measures runtime use, so demand for a separate loader is an estimate.
- 2025.stateofjs.com/en-US/other-tools: Node.js ranked first among runtimes reported by respondents.
- nodejs.org/api/environment_variables.html: Node provides built-in file loading and parsing.
- github.com/motdotla/dotenv/blob/v18.0.10/README.md: Documents the package’s loading and parsing scope.
Helps a lot6.6
How well does it do the job for those who need it?
Claude Opus 5.5: 6.0, likely 5.0 to 7.0
It does one thing well. The parser is mature, handles multiline values and comments, ships types and has an opt-in fast parser in v18. But it returns raw strings with no validation, coercion or schema, and Node's built-in loader now matches it for the basic case. Peers such as T3 Env, envalid and Varlock do the full job of loading plus checking.
- pkgpulse.com/guides/best-env-variable-management-nodejs-2026: dotenv gives raw strings with no validation
- github.com/motdotla/dotenv/blob/master/CHANGELOG.md: v18 adds a CLI and an opt-in fast parser
- npm hasTypes / dependencies: ships types, zero dependencies
GPT-6.2 Sol: 7.1, likely 6.0 to 8.1
Version 18.0.10 handles multiline values, multiple files, and explicit overrides through a small typed API and CLI. The short examples make basic setup straightforward for developers and coding agents, though callers using `config()` must check its returned file errors. Envalid covers validation and coercion, and dotenvx covers expansion and encryption. The opt-in fast parser has received compatibility fixes, and independent performance evidence for this version is thin.
- github.com/motdotla/dotenv/blob/v18.0.10/README.md: Documents precedence, error handling, the CLI, and the opt-in parser.
- docs.nestjs.com/application/configuration: Compares dotenv’s parser and precedence with Node’s built-in loader.
- github.com/af/envalid: Shows typed coercion and errors for missing or invalid values.
- github.com/motdotla/dotenv/blob/master/CHANGELOG.md: Records fixes for parser edge cases and TypeScript declarations.
Holds up over time6.9
Will it still be a good choice in two years?
Claude Opus 5.5: 7.0, likely 5.5 to 8.0
The project is active: 289 commits and 17 npm versions last year, an empty issue queue and a patch release on 2026-11-09. It rests mostly on one maintainer, whose company sells dotenvx as the successor. The recent major versions changed defaults and removed features, and native Node loading pulls new projects away from it.
- github commitsLastYear / npm versionsLastYear: 289 commits, 17 versions in the last year
- dotenvx.com/blog/2026/09/19/dotenv-18.html: v18 drops .env.vault, replaces the preload with a CLI, points users to dotenvx
- github.com/motdotla/dotenv/issues/899: user pushback on default tips; removed in 18.0.0
GPT-6.2 Sol: 6.8, likely 5.5 to 8.0
The project had 289 commits and 17 npm publishes in the past year, with a bundler regression fixed in the latest patch. It has public sponsors, and the depth of release ownership remains uncertain. A v17 user reported rolling back over startup logging, and v18 removed vault support. Node’s built-in loader and Vite’s use of it make future demand harder to predict.
- github commitsLastYear, npm versionsLastYear, npm latestPublishedAt: Active commits and npm publishing through November 2026.
- github.com/motdotla/dotenv/blob/master/CHANGELOG.md: Records the bundler fix and removal of `.env.vault` support.
- github.com/sponsors/motdotla: Lists public sponsorship for dotenv.
- reddit.com/r/node/comments/1mkjn76/absolutely_hate_the_new_v17_dotenv_injection_no: A user reported reverting to v16 because of startup output.
- github.com/vitejs/vite/blob/v8.2.2/packages/vite/src/node/env.ts: A released Vite version uses Node’s parser.
Used widely8.6
How many use it, and is that growing?
Claude Opus 5.5: 9.0, likely 8.0 to 9.5
It had over 1 billion downloads in four weeks and 1.23M dependent repos, by far the most direct use in the category. Much of the download count is transitive, through frameworks and tools. Its year-over-year ratio of about 3.6 is below the 4.1 median, so it is slowly losing share as native loading and newer tools spread.
- npm downloadsLast4Weeks / downloadsSame4WeeksYearAgo: 1.06B vs 295M, ratio ~3.6, below median 4.1
- dependents.repos: 1,228,719 dependent repos
- github stars: 20.5k stars, most in category
GPT-6.2 Sol: 8.2, likely 7.0 to 9.2
Ecosyste.ms found 1.23 million dependent repositories and 42,583 dependent npm packages. That is broad adoption, with some demand inherited from tools that install dotenv for their users. Downloads rose 3.61 times year over year, below the catalog median of 4.1 and behind dotenvx, T3 Env, c12, and Varlock. The direct share is hard to isolate, and four Bluesky links offer little evidence of fresh demand.
- dependents repos, dependents packages, github stars: Large dependent footprint and 20,571 repository stars.
- npm downloadsLast4Weeks, npm downloadsSame4WeeksYearAgo, medianDownloadsRatio, peers: Downloads grew from 295 million to 1.06 billion, below the catalog growth median.
- bluesky posts, peers blueskyPosts: Four links, fewer than dotenvx, c12, or Varlock.
- github.com/nestjs/config/releases: NestJS brings dotenv in as a dependency.
Vouched for7.6
Who stands behind it being good?
Claude Opus 5.5: 7.5, likely 6.5 to 8.5
Major tools have long built on dotenv or its format, and independent guides treat it as the baseline loader. Current write-ups more often recommend Node's native loader plus a validator, and the default-tips episode drew clear negative user feedback. There is little survey data specific to it.
- Vite and Next.js env loading: Vite uses dotenv and dotenv-expand; @next/env builds on the same format
- pistack.xyz/posts/2026-08-23-nodejs-config-libraries-dotenv-envalid-node-config-comparison: independent comparison treats dotenv as the standard loader
- github.com/motdotla/dotenv/issues/899: negative user reactions to default tips
GPT-6.2 Sol: 7.7, likely 6.5 to 8.8
Prisma ORM 7 recommends dotenv and generates a config that imports it. NestJS uses it as its default parser and documents where Node’s built-in parser behaves differently. These integrations support confidence in file loading, with limited evidence on satisfaction and performance for the current major version.
- prisma.io/docs/orm/v7/reference/prisma-config-reference: Prisma recommends dotenv and includes the import in generated configs.
- docs.nestjs.com/application/configuration: NestJS uses dotenv by default and compares behavior with Node’s parser.
- github.com/nestjs/config/releases: NestJS release notes verify adoption of dotenv 18.
Safe7.5
How safe is it to depend on?
Claude Opus 5.5: 7.5, likely 6.5 to 8.5
It has zero runtime dependencies, no advisories ever and a permissive BSD-2-Clause licence. The OpenSSF Scorecard is weak at 4.8, with no branch protection, no pinned dependencies, no SAST and limited code review. Publishing appears to rest with very few people.
- advisories.total: 0 advisories
- scorecard: 4.8; Branch-Protection, Token-Permissions, Pinned-Dependencies at 0
- npm dependencies / license: 0 deps, BSD-2-Clause
GPT-6.2 Sol: 7.4, likely 6.0 to 8.7
The package has zero runtime dependencies, a permissive BSD-2-Clause license, and zero advisories in the collected OSV record. Its OpenSSF Scorecard is 4.8, with zero scores for branch protection, token permissions, and dependency pinning. The source shows release tests and an npm packaging dry run, and a recent listing reports three maintainers. Current publisher permissions and release provenance remain unverified.
- npm dependencies, npm license, advisories total: Zero runtime dependencies or known OSV advisories and a permissive license.
- scorecard score, scorecard checks: Security policy scored 9, code review 4, and package signing was unscored.
- github.com/motdotla/dotenv/blob/v18.0.10/package.json: Shows release tests and an npm packaging dry run.
- security.snyk.io/package/npm/dotenv: Reports three maintainers in its 18.0.9 snapshot.
Good
- It has zero dependencies, a tiny surface and no advisories on record.
- Its .env parsing format is the de facto standard that most other tools copy or build on.
- It works in any Node setup, with config(), a CLI in v18, and environment variable switches.
- It is well understood by AI coding agents and has a huge body of examples.
Bad
- It does no validation or typing, so a separate tool such as T3 Env or envalid is still needed to check settings.
- Node 20.6+ and most frameworks (Vite, Next.js, Bun, Deno) already load .env files natively, which removes the need for it in many new projects.
- v17 printed a log line with product tips by default until v18 removed them, which annoyed users who only had it as a transitive dependency.
- v18 removed .env.vault and moved users from the -r dotenv/config preload to a CLI, the second major version in about 15 months.
The numbers
- npm downloads, 4 weeks
- 1.1B ×3.6 in a year
- GitHub stars
- 21k
- Commits, 12 months
- 289
- npm version
- 18.0.10 Nov 2026
- Versions, 12 months
- 17
- Advisories, 24 months
- 0 of 0 ever
- OpenSSF Scorecard
- 4.8 out of 10, Nov 2026
- Licence
- BSD-2-Clause
Read on 21 November 2026 from GitHub (motdotla/dotenv), npm (dotenv), OSV and the OpenSSF Scorecard.