DEV Community

Cover image for 🔍 Your .env file shouldn’t be a mystery box.
Suhel
Suhel

Posted on

🔍 Your .env file shouldn’t be a mystery box.

Over time, every project ends up with a cluttered, outdated, and hard-to-audit .env file.

  • Some variables are used.
  • Some are not.
  • And some? You have no idea.

That’s where envlens comes in.

What is envlens?
envlens is a lightweight tool that scans your project and identifies:-

✅ Which environment variables are actually used in your code

⚠️ Which variables in your .env file are unused or orphaned

📦 Optional: Checks .env.example and reports missing or extra keys

🧠 Bonus: Works with most JS/TS backends (Node.js, Next.js, etc.)

💡 Why is this helpful?
🧹 Clean up unused variables before deploying to production

🔐 Avoid leaking secrets you’re not even using

🤖 Automate env audits in CI/CD pipelines

📚 Keep .env.example in sync with actual usage

🛠 Perfect for teams, open source, and large monorepos

⚙️ How it works (1-min setup)
Install it:

npm install envlens
Enter fullscreen mode Exit fullscreen mode

Run it:

npx envlens

Enter fullscreen mode Exit fullscreen mode

And it’ll output which variables are:
Used ✅

Unused ⚠️

Missing 🔴

🧪 Currently in Beta
I just released envlens as a public beta, and I’d love your feedback. Try it in your real-world project, and let me know:

  • What works?
  • What’s confusing?
  • What’s missing?

🔗 Get Started
📦 NPM: https://www.npmjs.com/package/envlens
🗨️ DM me or open issues — I’m actively improving it!

🙌 If your .env has ever stressed you out, envlens is for you.

Top comments (2)

Collapse
 
xnivaxhzne profile image
Kavinkumar R

Can you add support for frontend code base?

Collapse
 
suhel_withai_8db26993d99 profile image
Suhel

Hi Kavinkumar R - Thanks for reaching out. Sure, I am planning frontend support (React, Next.js, Vite, etc.) in the next version.