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

advanced-env-manager

v1.0.4

Published

Advanced secure environment variable manager for local and server development

Readme

Advanced Environment Manager

A robust, secure environment variable management library for Node.js with validation, encryption, and AWS Secrets Manager integration.

Features

  • Environment variable validation with Joi schemas
  • AWS Secrets Manager integration (using AWS SDK v3)
  • Encryption/Decryption of sensitive values using AES-256-GCM
  • TypeScript support with full type definitions
  • Multiple environment support (development, production, test)
  • Type checking and default values
  • Graceful error handling with detailed error messages

Installation

npm install advanced-env-manager

Requirements

  • Node.js 18 or higher
  • For AWS Secrets Manager: AWS credentials configured

Usage

TypeScript / ES Modules

import EnvManager from 'advanced-env-manager';
import Joi from 'joi';

// Define your schema
const schema = Joi.object({
  NODE_ENV: Joi.string().valid('development', 'production', 'test').required(),
  PORT: Joi.number().default(3000),
  DATABASE_URL: Joi.string().uri().required(),
});

// Initialize the manager
const envManager = new EnvManager({
  encryptionKey: 'your-encryption-key',
  envPath: '.env',
  schema: schema,
  useCloud: true, // Set to true to use AWS Secrets Manager
});

// Use the manager
async function start() {
  try {
    const config = await envManager.initialize();
    console.log('Environment configured:', config);

    // Encrypt sensitive data
    const encrypted = envManager.encrypt('sensitive-value');
    console.log('Encrypted:', encrypted);

    // Decrypt when needed
    const decrypted = envManager.decrypt(encrypted);
    console.log('Decrypted:', decrypted);
  } catch (error) {
    console.error('Configuration error:', error);
  }
}

start();

CommonJS

const { EnvManager } = require('advanced-env-manager');
const Joi = require('joi');
// ... same as above

API Reference

EnvManager

Main class for managing environment variables.

Constructor Options

interface EnvManagerOptions {
  encryptionKey?: string; // Encryption key (or set ENV_ENCRYPTION_KEY)
  envPath?: string; // Path to .env file (default: '.env')
  schema?: Schema; // Joi schema for validation
  useCloud?: boolean; // Enable AWS Secrets Manager (default: false)
}

Methods

  • initialize(): Promise<EnvConfig> - Loads and validates environment variables
  • encrypt(value: string): string - Encrypts a sensitive value
  • decrypt(encryptedValue: string): string - Decrypts an encrypted value

Examples

See the examples directory for more usage examples:

Environment Variables

Local Environment Variables

  • NODE_ENV: Application environment (development/production/test)
  • PORT: Application port
  • DATABASE_URL: Database connection string
  • ENV_ENCRYPTION_KEY: Key for encrypting sensitive values (32+ characters recommended)

AWS Secrets Manager

  • AWS_REGION: AWS region for Secrets Manager (default: us-east-1)
  • AWS_SECRET_NAME: Name of the secret in AWS Secrets Manager (default: 'default')

Development

Testing Locally

  1. Clone the repository
  2. Install dependencies: npm install
  3. Run tests: npm test
  4. Run tests with coverage: npm run test:coverage
  5. Run linter: npm run lint
  6. Format code: npm run format

Building

npm run build

Security Notes

  • Encryption Key: Use a strong, random encryption key (32+ characters). Store it securely and never commit it to version control.
  • AWS Credentials: Configure AWS credentials using AWS CLI, IAM roles, or environment variables. Never hardcode credentials.
  • Environment Files: Add .env files to .gitignore to prevent committing sensitive data.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Contributors

  • Rikwu Godwin Onyung
  • Ghedinaeval Charles Don-Ibor
  • Michael Fredrick Ikaka
  • Godfrey Lebo

License

ISC