Skip to main content

Configuration

The SDK uses a layered configuration system that prioritizes explicit options, falls back to environment variables, and auto-detects everything it can.

Configuration Hierarchy

Environment Variables

Auto-Detection

Mode Detection

Mode is determined from the API key prefix:

Environment Detection

The SDK checks these signals in order:
  1. ZENDFI_ENVIRONMENT env var
  2. NODE_ENV value (production / staging / development)
  3. Browser hostname (localhost = development, .vercel.app = staging)
  4. Falls back to development

Safety Warnings

The SDK prints warnings for dangerous mode/environment mismatches:

CLI Credentials

If you ran zendfi init, the SDK loads your key from ~/.zendfi/credentials.json:
This means you can use the SDK without any configuration in projects that have been initialized with the CLI:

Full Config Reference

Default Values