🚀 DAY 5 OF LAUNCH WEEK: Introducing Socket Firewall Enterprise.Learn more →
Socket
Book a DemoInstallSign in
Socket

@arcjet/env

Package Overview
Dependencies
Maintainers
3
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@arcjet/env

Arcjet environment detection

latest
Source
npmnpm
Version
1.0.0-beta.13
Version published
Weekly downloads
17K
-18.9%
Maintainers
3
Weekly downloads
 
Created
Source
Arcjet Logo

@arcjet/env

npm badge

Arcjet environment detection.

Currently operates on an environment object with the type:

type Env = {
  FLY_APP_NAME?: string;
  NODE_ENV?: string;
  ARCJET_KEY?: string;
  ARCJET_ENV?: string;
  ARCJET_LOG_LEVEL?: string;
  ARCJET_BASE_URL?: string;
};

What is this?

This is a utility that reads configuration for us from process.env and similar. It exists so that we can access that configuration throughout our packages.

When should I use this?

You should probably not use this but there are some edge cases where we let users swap more advanced features out and then it may be useful.

Install

This package is ESM only. Install with npm in Node.js:

npm install @arcjet/env

Example

import process from "node:process";
import {
  apiKey,
  baseUrl,
  isDevelopment,
  logLevel,
  platform,
} from "@arcjet/env";

console.log(platform({ FLY_APP_NAME: "foobar" })); // => "fly-io"
console.log(platform({})); // => undefined
console.log(isDevelopment({ NODE_ENV: "production" })); // => false
console.log(isDevelopment({ NODE_ENV: "development" })); // => true
console.log(isDevelopment({ ARCJET_ENV: "production" })); // => false
console.log(isDevelopment({ ARCJET_ENV: "development" })); // => true
console.log(logLevel({ ARCJET_LOG_LEVEL: "debug" })); // => "debug"
console.log(logLevel({ ARCJET_LOG_LEVEL: "info" })); // => "info"
console.log(logLevel({ ARCJET_LOG_LEVEL: "warn" })); // => "warn"
console.log(logLevel({ ARCJET_LOG_LEVEL: "error" })); // => "error"
console.log(logLevel({ ARCJET_LOG_LEVEL: "" })); // => "warn"
console.log(baseUrl(process.env)); // => "https://decide.arcjet.com"
console.log(apiKey({ ARCJET_KEY: "ajkey_abc123" })); // => "ajkey_abc123"
console.log(apiKey({ ARCJET_KEY: "invalid" })); // => undefined

License

Apache License, Version 2.0 © Arcjet Labs, Inc.

Keywords

arcjet

FAQs

Package last updated on 07 Oct 2025

Did you know?

Socket

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.

Install

Related posts