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
Run it:
npx envlens
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)
Can you add support for frontend code base?
Hi Kavinkumar R - Thanks for reaching out. Sure, I am planning frontend support (React, Next.js, Vite, etc.) in the next version.