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

secure-cm

v2025.9.8

Published

A package to manage secrets safely. Loads .env, .yaml, or JSON configs, auto-encrypts/decrypts sensitive keys, and supports versioned configs for multiple environments.

Readme

Secure-CM

A simple and powerful package to manage your application secrets safely.

Secure-CM loads configurations from .env, .yaml, or .json files, automatically encrypts sensitive keys before saving, and decrypts them on load. It is designed for modern development workflows, especially for SaaS products and multi-environment deployments that require a clear separation of configuration and secrets.

Secure-CM

Features

  • Multi-Format Support: Load configurations from .env, .yaml, or .json files.

  • Automatic Encryption: Sensitive values are automatically encrypted using AES-256-CBC.

  • Environment-Specific Configs: Manage separate configurations for development, production, staging, etc.

  • Easy to Use: Simple, intuitive API for loading, getting, setting, and saving configurations.

  • Version Control Friendly: Store encrypted configuration files safely in your version control system.

Use Cases

  • SaaS Products: Manage different database credentials, API keys, and feature flags for multiple tenants or environments.

  • Multi-Environment Deployments: Keep your production, staging, and development configurations separate and secure.

  • Open Source Projects: Allow contributors to use a template configuration without exposing sensitive project keys.

Installation

npm install secure-cm

Quick Start

  1. Create a configuration file.

    Create a config directory in your project root. Inside, create a file for your environment, e.g., development.json.

    ./config/development.json

    {
      "DB_HOST": "localhost",
      "DB_USER": "root",
      "DB_PASS": "my-secret-password",
      "API_KEY": "another-secret-key"
    }
  2. Initialize the manager and load your config.

    You'll need a 32-character secret key for encryption. You can store this in a secure place like your hosting environment's secret manager or an environment variable.

    const SecureCM = require('secure-cm');
        
    // WARNING: Do not hardcode your secret key in production. 
    // Use an environment variable or a secret management service.
    const secretKey = process.env.CONFIG_SECRET_KEY || 'a-secure-32-character-secret-key';
        
    const configManager = new SecureCM({
        env: 'development',
        secretKey: secretKey,
        configDir: './config' // Optional, defaults to ./config
    });
        
    // Specify which keys are sensitive and should be encrypted
    configManager.load(['DB_PASS', 'API_KEY']);
        
    // Access your configuration
    console.log('DB Host:', configManager.get('DB_HOST')); // 'localhost'
    console.log('DB Password:', configManager.get('DB_PASS')); // 'my-secret-password' (decrypted)
  3. Save an encrypted version of your config.

    Run this once to create an encrypted version of your config file. You can then safely commit this file to version control.

    // This will encrypt 'DB_PASS' and 'API_KEY' and save a new file.
    configManager.save('json'); 

    Your development.json will now look like this:

    ./config/development.json

    {
      "DB_HOST": "localhost",
      "DB_USER": "root",
      "DB_PASS": "iv_hex:encrypted_password_hex",
      "API_KEY": "iv_hex:encrypted_key_hex"
    }

    Now, you can safely commit this file. The original plain-text values are never exposed.

API Reference

new SecureCM(options)

Creates a new instance.

  • options <Object>

    • env <string> The current environment (e.g., 'production'). Default: 'development'.

    • configDir <string> The directory where config files are located. Default: './config'.

    • secretKey <string> Required. A 32-character string used for encryption and decryption.

.load(sensitiveKeys)

Loads the configuration file for the specified environment.

  • sensitiveKeys <string[]> An array of keys within the configuration that should be treated as sensitive and decrypted upon loading.

.get(key)

Retrieves a configuration value.

  • key <string> The key of the value to retrieve.

.set(key, value)

Sets a configuration value in memory.

  • key <string> The key of the value to set.

  • value <any> The value to set.

.save(format)

Encrypts sensitive keys and saves the entire configuration to a new file.

  • format <string> The format to save the file in ('json', 'yaml', or 'env'). Default: 'json'.

Contributing

Contributions are welcome! Please read our CONTRIBUTING.md for details on our code of conduct and the process for submitting pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

This packages codes was created by Mamedul Islam and open for contribute.

As a passionate web developer with experience in creating interactive and user-friendly web components. Currently available for freelance projects or full-time opportunities.

Helping businesses grow their online presence with custom web solutions. Specializing in WordPress, WooCommerce, NodeJS, and Shopify. Building modern, responsive, and high-performance scalable websites with custom made plugins, codes, customizations.

Changelog

Please see the CHANGELOG.md file.