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

slopenv

v1.0.3

Published

Sensible environment variable loading for monorepos.

Readme

slopenv

An enhanced dotenv wrapper that simplifies environment management in complex directory structures. Features hierarchical file lookup and deterministic override logic, specifically designed for monorepos.

Features

  • 🏢 Monorepo Aware: Automatically detects monorepo roots (pnpm, Yarn, NPM, Turbo, Nx, Lerna).
  • 🌲 Hierarchical Loading: Loads .env files from both the package level and the monorepo root.
  • 🎯 Deterministic Precedence: Clear override logic where local files take precedence over shared ones.
  • 🔄 Automatic NODE_ENV Detection: Can infer the environment mode from the .env files themselves.
  • Async Support: Provides both synchronous and asynchronous APIs for flexibility.
  • 🛡️ Non-Destructive: Never overrides variables already present in process.env.
  • 📦 Zero Config: Works out of the box with sensible defaults.

Installation

npm install slopenv
# or
pnpm add slopenv
# or
yarn add slopenv

Usage

Simple Usage

The easiest way to use slopenv is to call it at the very beginning of your application:

import { config } from 'slopenv';

// Populates process.env based on hierarchical lookup
config();

console.log(process.env.MY_VAR);

Asynchronous Usage

For environments where non-blocking I/O is preferred during startup:

import { configAsync } from 'slopenv';

async function bootstrap() {
  await configAsync();
  console.log(process.env.MY_VAR);
}

bootstrap();

Advanced Usage

If you prefer to get the parsed variables without automatically populating process.env:

import { load, loadAsync } from 'slopenv';

// Synchronous
const env = load();
console.log(env.MY_VAR);

// Asynchronous
const envAsync = await loadAsync();

You can also specify a custom root directory as the starting point for the search:

config('/path/to/project');
// or
await configAsync('/path/to/project');

TypeScript Support

slopenv is written in TypeScript and provides built-in types. You can import the DotenvParseOutput type if needed:

import { load, DotenvParseOutput } from 'slopenv';

const env: DotenvParseOutput = load();

Loading Logic & Precedence

slopenv looks for .env files in the following order (higher items have higher precedence):

  1. process.env (Existing variables are never overridden)
  2. Package Level (nearest package.json):
    • .env.local
    • .env.[mode].local
    • .env.[mode]
    • .env
  3. Monorepo Root Level:
    • .env.local
    • .env.[mode].local
    • .env.[mode]
    • .env.shared
    • .env

Mode Detection

The [mode] is determined by:

  1. process.env.NODE_ENV if it's already set.
  2. If not set, slopenv scans the .env files (starting from the package level) for a NODE_ENV definition and uses the first one it finds to trigger the loading of mode-specific files.

License

MIT © shurizzle