
Security News
Socket Named a Supply Chain Innovator in Latio's 2026 Application Security Market Report
Latio’s 2026 report recognizes Socket as a Supply Chain Innovator and highlights our work in 0-day malware detection, SCA, and auto-patching.
Runtime agnostic JS utils
# Using npm
npm i std-env
# Using pnpm
pnpm i std-env
# Using yarn
yarn add std-env
// ESM
import { env, isDevelopment, isProduction } from "std-env";
// CommonJS
const { env, isDevelopment, isProduction } = require("std-env");
hasTTYhasWindowisDebugisDevelopmentisLinuxisMacOSisMinimalisProductionisTestisWindowsplatformisColorSupportednodeVersionnodeMajorVersionYou can read more about how each flag works from ./src/flags.ts.
std-env can automatically detect the current runtime provider based on environment variables.
You can use isCI and platform exports to detect it:
import { isCI, provider, providerInfo } from "std-env";
console.log({
isCI, // true
provider, // "github_actions"
providerInfo, // { name: "github_actions", isCI: true }
});
List of well known providers can be found from ./src/providers.ts.
std-env can automatically detect the current JavaScript runtime based on global variables, following the WinterCG Runtime Keys proposal:
import { runtime, runtimeInfo } from "std-env";
// "" | "node" | "deno" | "bun" | "workerd" ...
console.log(runtime);
// { name: "node" }
console.log(runtimeInfo);
You can also use individual named exports for each runtime detection:
[!NOTE] When running code in Bun and Deno with Node.js compatibility mode,
isNodeflag will be alsotrue, indicating running in a Node.js compatible runtime.Use
runtime === "node"if you need strict check for Node.js runtime.
isNodeisBunisDenoisNetlifyisEdgeLightisWorkerdisFastlyList of well known providers can be found from ./src/runtimes.ts.
envstd-env provides a lightweight proxy to access environment variables in a platform agnostic way.
import { env } from "std-env";
processstd-env provides a lightweight proxy to access process object in a platform agnostic way.
import { process } from "std-env";
MIT
cross-env allows you to set and use environment variables across platforms. It's similar to std-env in the sense that it helps manage environment-specific settings, but it focuses more on setting environment variables rather than detecting the environment.
dotenv is a package that loads environment variables from a .env file into process.env. While it serves a different purpose by managing environment variables, it complements std-env's functionality by allowing developers to configure their applications based on the detected environment.
FAQs
Runtime agnostic JS utils
The npm package std-env receives a total of 32,399,377 weekly downloads. As such, std-env popularity was classified as popular.
We found that std-env demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Latio’s 2026 report recognizes Socket as a Supply Chain Innovator and highlights our work in 0-day malware detection, SCA, and auto-patching.

Company News
Join Socket for live demos, rooftop happy hours, and one-on-one meetings during BSidesSF and RSA 2026 in San Francisco.

Research
/Security News
Malicious Packagist packages disguised as Laravel utilities install an encrypted PHP RAT via Composer dependencies, enabling remote access and C2 callbacks.