Skip to main content

env()

Last updated 4/02/2026

Definition​

The

env()
is a function on the
Five
object that lets you read an environment variable from the Five runtime by name.

It performs the following:

  • Looks up an environment-specific value (for example, values in development, testing, and production)
  • Returns that value as a string
  • Lets your code behave differently depending on where it's running

It is typically used for:

  • Reading configuration values
  • Avoiding hard-coded values in code
  • Switching behavior between environments without changing logic

Key Characteristics​

  • Read-only: it retrieves values, it doesn't set them
  • Environment-aware: the same key can return different values in development, testing, or production

Function Signature​

Available

Client and Server

Function Signature
env(name: string) : string;

ParameterTypeDescription
name
stringThe key identifying the environment variable whose value should be returned

Return Value​

A string representing the value of the specified environment variable

Examples​

env()