Environment Variables Reference

Complete reference for all environment variables used in Temps.


Server Configuration

These environment variables configure the Temps server itself:

VariableCLI FlagDefaultDescription
TEMPS_ADDRESS--address127.0.0.1:3000HTTP server address and port
TEMPS_TLS_ADDRESS--tls-address(optional)HTTPS server address and port
TEMPS_DATA_DIR--data-dir~/.tempsData directory for keys and configuration
TEMPS_LOG_LEVEL--log-levelinfoLog level: trace, debug, info, warn, error
TEMPS_CONSOLE_ADDRESS--console-address(optional)Admin console address and port

Example

export TEMPS_ADDRESS=0.0.0.0:8080
export TEMPS_TLS_ADDRESS=0.0.0.0:8443
export TEMPS_LOG_LEVEL=debug
export TEMPS_DATA_DIR=/var/lib/temps

Database Configuration

VariableCLI FlagDefaultDescription
TEMPS_DATABASE_URL--database-url(required)PostgreSQL connection string

Database URL Format

postgresql://[user[:password]@][host][:port][/database][?param1=value1&...]

Example

export TEMPS_DATABASE_URL=postgresql://temps:password@localhost:5432/temps

Data Directory

Temps stores sensitive data in the data directory (~/.temps by default):

~/.temps/
├── encryption_key    # AES-256 encryption key (auto-generated)
└── auth_secret       # Session authentication secret (auto-generated)

Application Environment Variables

These are environment variables you configure for your deployed applications:

Setting Environment Variables

Environment variables can be set per project and environment:

Via Dashboard:

  1. Navigate to Project → Environment → Settings
  2. Go to Environment Variables section
  3. Add or edit variables

Via CLI:

bunx @temps-sdk/cli environments vars set \
  -p my-app \
  DATABASE_URL "postgresql://user:pass@host/db"

Via API:

await fetch("/api/projects/my-app/environments/production/env-vars", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${API_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    key: "DATABASE_URL",
    value: "postgresql://user:pass@host/db",
  }),
});

Reserved Variables

Temps automatically sets these variables in your containers:

VariableDescription
HOSTSet to 0.0.0.0 to bind to all interfaces
PORTPort number your application should listen on
TEMPS_PROJECT_IDCurrent project ID
TEMPS_ENVIRONMENT_IDCurrent environment ID
TEMPS_DEPLOYMENT_IDCurrent deployment ID

Framework-Specific Variables

Common environment variables for popular frameworks:

Next.js:

NODE_ENV=production
NEXT_PUBLIC_API_URL=https://api.example.com

React/Vite:

VITE_API_URL=https://api.example.com

Node.js:

NODE_ENV=production
PORT=3000

Python:

PYTHONUNBUFFERED=1
FLASK_ENV=production

CLI Configuration

These environment variables configure the Temps CLI:

VariableDescription
TEMPS_API_URLAPI endpoint URL (e.g., https://app.temps.davidviejo.dev)
TEMPS_API_TOKENAPI authentication token
TEMPS_API_KEYAPI key (alternative to token)
NO_COLORDisable colored output (set to 1 or true)

Example

export TEMPS_API_URL=https://app.temps.davidviejo.dev
export TEMPS_API_TOKEN=your-token-here

Configuration Files

CLI configuration is stored in:

  • Config file: ~/.temps/config.json
  • Credentials: ~/.temps/.secrets

Use bunx @temps-sdk/cli configure show to view current configuration.


SDK Configuration

Node.js SDK

VariableDescription
TEMPS_API_URLYour Temps API URL
TEMPS_TOKENYour API key or deployment token
TEMPS_PROJECT_IDProject ID (optional, can be set in code)

React Analytics SDK

VariableDescription
NEXT_PUBLIC_TEMPS_API_URLTemps API URL (for Next.js)
NEXT_PUBLIC_TEMPS_PROJECT_IDProject ID (for Next.js)

Example

# Node.js SDK
export TEMPS_API_URL=https://app.temps.davidviejo.dev
export TEMPS_TOKEN=your-token-here

# Next.js with React Analytics
export NEXT_PUBLIC_TEMPS_API_URL=https://app.temps.davidviejo.dev
export NEXT_PUBLIC_TEMPS_PROJECT_ID=123

Precedence Rules

Environment variables are resolved in the following order (highest to lowest priority):

  1. Container Environment Variables (set at deployment time)
  2. Environment-Specific Variables (set in dashboard/CLI for the environment)
  3. Project-Level Variables (set in dashboard/CLI for the project)
  4. System Environment Variables (from the host system)
  5. Default Values (if any)

Example

If you set:

  • Project-level: DATABASE_URL=postgres://project/db
  • Environment-level: DATABASE_URL=postgres://env/db
  • Container-level: DATABASE_URL=postgres://container/db

The container will use: postgres://container/db (highest priority).

Variable Override

You can override any variable at a more specific level:

# Project-level (applies to all environments)
bunx @temps-sdk/cli environments vars set \
  -p my-app \
  API_URL "https://api.example.com"

# Environment-level (overrides project-level)
bunx @temps-sdk/cli environments vars set \
  -p my-app \
  -e production \
  API_URL "https://api-prod.example.com"

Best Practices

Security

  • Never commit secrets: Use environment variables for sensitive data
  • Use different values per environment: Production should have different credentials than staging
  • Rotate secrets regularly: Update API keys and tokens periodically
  • Use secure storage: Consider using secret management tools for production

Organization

  • Use descriptive names: DATABASE_URL is better than DB
  • Document variables: Keep a list of required variables in your README
  • Group related variables: Use prefixes like DATABASE_, API_, REDIS_
  • Set defaults when possible: Provide sensible defaults in your application code

Debugging

  • Check variable precedence: Verify which value is actually being used
  • Use logging: Log variable names (not values) to verify they're set
  • Test locally: Use .env files for local development
  • Verify in dashboard: Check environment variables in the Temps dashboard

Additional Resources

Was this page helpful?