Using different .env files in your Node project
Install the dotenvx package:
npm install @dotenvx/dotenvx
Then I created a file named .env.dev and put my environment settings in it.
Then I added this script to the package.json file:
"dev": "dotenvx run --env-file=.env.dev -- nodemon server.js"
And now, when I run npm run dev it loads the settings from .env.dev into the environment variables!