Environment

getEnv

Read one environment variable — MANIC_PUBLIC_* only in the browser; full process.env on server/Bun.

getEnv(key)

import { getEnv } from 'manicjs/env';

Signature

function getEnv(key: string): string | undefined;

Browser behavior

  • Only keys prefixed with MANIC_PUBLIC_ return a value (from window.__MANIC_ENV__ injected at build time).
  • Other keys log a console warning and return undefined.

Server behavior

When window is undefined, getEnv reads process.env[key] — no prefix restriction.


Parameters

Prop

Type


See also

On this page