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

envpro-cli

v1.0.0

Published

CLI tool for managing environment files with TypeScript support

Downloads

4

Readme

envpro 🌱

A powerful environment management tool for Node.js applications. Manage, encrypt, and switch between different environment configurations with ease.

Features ✨

  • 🔐 Secure Encryption: Encrypt your environment files with AES-256-GCM
  • 🔄 Environment Switching: Easily switch between different environments
  • 🔑 Key Management: Automatic key generation and storage
  • 📦 Backup System: Automatic backups with easy restoration
  • 🛡️ Security: Secure key storage and encrypted files
  • 🎯 TypeScript Support: Built with TypeScript for better development experience
  • 🔍 Environment Validation: Validate environment variables against a schema
  • 🔄 Automatic Loading: Load environment variables without dotenv dependency

Installation 📦

# Install globally
npm install -g envpro

# Or install as a dev dependency
npm install --save-dev envpro

Quick Start 🚀

  1. Initialize envpro in your project:

    envpro init
  2. Create your first environment:

    envpro new development
  3. Add your environment variables:

    # Edit .env.development
    DATABASE_URL=postgres://user:pass@localhost:5432/dev_db
    API_KEY=your_api_key
  4. Encrypt your environment:

    envpro encrypt development
  5. Use the environment in your code:

    import { useEnv, getEnvVar } from 'envpro/utils/env-loader';
    
    // Load environment variables
    await useEnv({
        environment: 'development'
    });
    
    // Access variables
    const dbUrl = getEnvVar('DATABASE_URL');

Sample Project Usage 🏗️

1. Project Setup

# Initialize project
mkdir my-app
cd my-app
npm init -y
npm install --save-dev envpro typescript @types/node

2. Configure TypeScript

// tsconfig.json
{
  "compilerOptions": {
    "target": "ES2020",
    "module": "commonjs",
    "outDir": "./dist",
    "rootDir": "./src",
    "strict": true,
    "esModuleInterop": true
  }
}

3. Initialize envpro

envpro init
envpro new development
envpro new production

4. Add Environment Variables

# .env.development
DATABASE_URL=postgres://user:pass@localhost:5432/dev_db
API_KEY=dev_api_key
PORT=3000
NODE_ENV=development

# .env.production
DATABASE_URL=postgres://user:pass@prod-db:5432/prod_db
API_KEY=prod_api_key
PORT=80
NODE_ENV=production

5. Encrypt Environments

envpro encrypt development
envpro encrypt production

6. Create Application Code

// src/index.ts
import { useEnv, getEnvVar } from 'envpro/utils/env-loader';

async function main() {
    // Load environment variables
    await useEnv({
        environment: process.env.NODE_ENV || 'development'
    });

    // Access variables
    const dbUrl = getEnvVar('DATABASE_URL');
    const port = getEnvVar('PORT') || '3000';
    const apiKey = getEnvVar('API_KEY');

    console.log('Database URL:', dbUrl);
    console.log('Port:', port);
    console.log('API Key:', apiKey ? '***' : 'Not set');
}

main().catch(console.error);

7. Build and Run

# Build
npm run build

# Run in development
NODE_ENV=development node dist/index.js

# Run in production
NODE_ENV=production node dist/index.js

Advanced Usage Examples 🚀

1. Environment Validation

import { useEnv, getEnvVar } from 'envpro/utils/env-loader';

interface EnvSchema {
    DATABASE_URL: string;
    API_KEY: string;
    PORT?: string;
}

async function validateEnv(): Promise<EnvSchema> {
    await useEnv();
    
    const requiredVars = ['DATABASE_URL', 'API_KEY'];
    for (const key of requiredVars) {
        if (!getEnvVar(key)) {
            throw new Error(`Missing required environment variable: ${key}`);
        }
    }

    return {
        DATABASE_URL: getEnvVar('DATABASE_URL')!,
        API_KEY: getEnvVar('API_KEY')!,
        PORT: getEnvVar('PORT')
    };
}

2. Multiple Environment Support

import { useEnv, getEnvVar } from 'envpro/utils/env-loader';

class Config {
    private static instance: Config;
    private env: string;

    private constructor() {
        this.env = process.env.NODE_ENV || 'development';
    }

    static async getInstance(): Promise<Config> {
        if (!Config.instance) {
            Config.instance = new Config();
            await useEnv({
                environment: Config.instance.env,
                override: true
            });
        }
        return Config.instance;
    }

    getDatabaseUrl(): string {
        return getEnvVar('DATABASE_URL')!;
    }

    getApiKey(): string {
        return getEnvVar('API_KEY')!;
    }

    getPort(): number {
        return parseInt(getEnvVar('PORT') || '3000', 10);
    }
}

// Usage
async function main() {
    const config = await Config.getInstance();
    console.log('Database URL:', config.getDatabaseUrl());
    console.log('Port:', config.getPort());
}

3. Environment Switching in Tests

import { useEnv } from 'envpro/utils/env-loader';

describe('My Test Suite', () => {
    beforeAll(async () => {
        await useEnv({
            environment: 'test',
            override: true
        });
    });

    it('should use test environment variables', () => {
        expect(process.env.NODE_ENV).toBe('test');
        // ... rest of your test
    });
});

Security Best Practices 🔒

  1. Key Management:

    • Keys are stored in .envpro/keys/
    • Each environment has its own key
    • Keys are automatically generated and managed
  2. File Security:

    • Never commit unencrypted .env files
    • Keep .envpro/keys/ in a secure location
    • Use different keys for different environments
  3. Backup Strategy:

    • Regular backups using envpro backup
    • Store backups securely
    • Use the restore system for recovery

Troubleshooting 🛠️

Common Issues

  1. Key Not Found

    ❌ No encryption key found!
    💡 Please ensure:
      1. The key exists in .envpro/keys/
      2. Or set it as an environment variable: ENCRYPTION_KEY=your_key

    Solution: Run envpro encrypt <environment> to generate a new key.

  2. File Not Found

    ❌ Environment file not found: .env.production

    Solution: Create the environment first using envpro new production.

  3. Decryption Failed

    ❌ Decryption failed: Invalid encryption key

    Solution: Ensure you're using the correct key for the environment.

Contributing 🤝

  1. Fork the repository
  2. Create your feature branch
  3. Commit your changes
  4. Push to the branch
  5. Create a Pull Request

License 📄

MIT License - feel free to use this tool in your projects!

Support 💖

If you find this tool helpful, please consider giving it a ⭐️ on GitHub!


Made with ❤️ by [Avijit Sen]