npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

env-harvester

v1.0.2

Published

Automatically discover environment variables used across your codebase and generate professional `.env` and `.env.example` files with contextual placeholders and developer guidance.

Readme

Env Harvester

Automatically discover environment variables used across your codebase and generate professional .env and .env.example files with contextual placeholders and developer guidance.

Overview

Env Harvester is an AI-powered CLI tool that scans JavaScript and TypeScript projects, detects environment variable usage, and generates ready-to-use environment configuration files.

Instead of manually creating .env files, Env Harvester analyzes your codebase, identifies required variables, and uses Gemini AI to provide:

  • Realistic placeholder values
  • Provider-specific setup instructions
  • Usage location tracking
  • Automatic .env and .env.example generation

Features

  • Automatic environment variable discovery
  • Supports JavaScript, TypeScript, React, Next.js, and Node.js projects
  • Generates both .env and .env.example
  • Tracks where each variable is used
  • AI-generated setup instructions
  • Safe file creation logic
  • Zero configuration setup
  • Smart handling of existing environment files

Installation

Global Installation

npm install -g env-harvester

Using NPX

npx env-harvester

Requirements

  • Node.js 18 or later
  • Gemini API Key

You can generate a Gemini API key from Google AI Studio.


Setting Up GEMINI_API_KEY

Windows (Command Prompt)

Temporary (current terminal session only):

set GEMINI_API_KEY=your_api_key_here

Permanent:

setx GEMINI_API_KEY "your_api_key_here"

Verify:

echo %GEMINI_API_KEY%

Windows (PowerShell)

Temporary:

$env:GEMINI_API_KEY="your_api_key_here"

Permanent:

[Environment]::SetEnvironmentVariable(
    "GEMINI_API_KEY",
    "your_api_key_here",
    "User"
)

Verify:

$env:GEMINI_API_KEY

macOS (zsh)

Temporary:

export GEMINI_API_KEY="your_api_key_here"

Permanent:

echo 'export GEMINI_API_KEY="your_api_key_here"' >> ~/.zshrc
source ~/.zshrc

Verify:

echo $GEMINI_API_KEY

Linux (bash)

Temporary:

export GEMINI_API_KEY="your_api_key_here"

Permanent:

echo 'export GEMINI_API_KEY="your_api_key_here"' >> ~/.bashrc
source ~/.bashrc

Verify:

echo $GEMINI_API_KEY

Using a .env File

You may also create a .env file:

GEMINI_API_KEY=your_api_key_here

Usage

Navigate to your project directory and run:

env-harvester

The CLI will:

  1. Crawl your project files
  2. Detect environment variables
  3. Track usage locations
  4. Consult Gemini AI for contextual placeholders
  5. Generate configuration files
  6. Add setup instructions for each variable

Example Output

Generated .env file:

# Used in: src/config/database.js
# How to get: Create a MongoDB Atlas cluster and copy the connection string.
MONGODB_URI=mongodb+srv://username:[email protected]/db

# Used in: src/server.js
# How to get: Standard local development port.
PORT=3000

# Used in: src/services/stripe.js
# How to get: Stripe Dashboard → Developers → API Keys.
STRIPE_SECRET_KEY=sk_test_xxxxxxxxxxxx

Smart File Handling

Scenario 1

Existing files:

.env
.env.example

Result:

No changes made.

Scenario 2

Existing files:

.env

Result:

Creates only .env.example

Scenario 3

Existing files:

None

Result:

Creates both .env and .env.example

Scenario 4

Existing files:

.env.example

Result:

Creates only .env

Supported File Types

.js
.jsx
.ts
.tsx

Ignored Directories

node_modules
.git
dist
build
generated
.next
coverage

Example Workflow

cd my-project

env-harvester

Output:

✔ Crawling project directory...
✔ Scanning files and tracking usage locations...
✔ Consulting AI to infer context and safe fallbacks...
✔ Writing configuration files...
✔ Success! Harvested 12 variables. Created both .env and .env.example.

Security Notice

Env Harvester never generates real secrets or production credentials.

All generated values are placeholders intended to help developers configure their projects quickly and safely. Actual credentials should always be obtained directly from the corresponding service provider.


Current Detection Support

Currently detects:

process.env.MY_VARIABLE;

Planned Improvements

  • Support for import.meta.env
  • Support for destructured environment variables
const { API_KEY } = process.env;
  • Support for bracket notation
process.env["API_KEY"];
process.env["API_KEY"];
  • Monorepo support
  • Interactive mode
  • CI/CD integration
  • VS Code extension
  • Secret validation

Contributing

Contributions, suggestions, and bug reports are welcome.

Please open an issue before submitting major changes.


Author

Sujal Dey


License

Copyright (c) 2026 Sujal Dey

All Rights Reserved.

Permission is granted to use this software.

You may not:

  • Modify the software
  • Create derivative works
  • Redistribute the software
  • Publish modified versions
  • Sell, sublicense, or repackage the software
  • Remove copyright notices

This software is provided "as is" without warranty of any kind.