
Goodbye `dotenv` and `nodemon`: A Cleaner Workflow with Node.js ≥ 20.6
Modern Node.js just got a lot simpler. If you’re running Node.js 20.6 or later, you can finally drop two long-time staples of the Node ecosystem: dotenv and nodemon. Thanks to built-in environment file loading and native file-watching, many projects no longer need these extra dependencies at all.
Native .env Support
Node.js now lets you load environment variables directly with a simple flag:
node --env-file=.env app.js
No more dotenv dependency, no extra setup. It’s built into Node, works the same way, and keeps your project lighter and cleaner—especially in production, where external .env loaders often aren’t ideal.
Native File Watching
For development, you can now run:
node --watch app.js
This works just like nodemon, automatically restarting your app when files change. It’s fast, stable, and doesn’t require installing or configuring anything.
When to Still Use dotenv or nodemon
You might still reach for them if you need advanced parsing, multiple env files, custom watch rules, or if your team relies on them for an established workflow. But for most projects, the built-in functionality is more than enough.
The New Default Workflow
If you’re on Node.js ≥ 20.6:
- Use
node --env-fileto load environment variables - Use
node --watchfor development reloads - Only install dotenv or nodemon if you truly need their extra features
Node.js is finally shedding some of its most common dependencies—and your project just got cleaner.