Skip to content

Environment Variables

Varity Team Core Contributors Updated March 2026

Varity manages most credentials automatically. You only need to set environment variables for services you manage yourself.

.env.local
# Your Varity App ID (from developer portal)
NEXT_PUBLIC_VARITY_APP_ID=your-app-id

These variables are only needed for specific use cases:

VariableRequired ForDefault
NEXT_PUBLIC_VARITY_APP_IDApp identityDev default
VARITY_API_URLCustom API endpointhttps://varity.app
VARITY_API_KEYAPI authenticationAuto-provided
.env.local
# Varity SDK (optional — dev defaults work automatically)
NEXT_PUBLIC_VARITY_APP_ID=your-app-id

In development, the SDK uses shared credentials automatically. No other variables are needed.

Different frameworks require different prefixes for client-side variables:

FrameworkPrefixExample
Next.jsNEXT_PUBLIC_NEXT_PUBLIC_VARITY_APP_ID
ViteVITE_VITE_VARITY_APP_ID
Create React AppREACT_APP_REACT_APP_VARITY_APP_ID
  • Use .env.local for local development (git-ignored)
  • Store production secrets in your CI/CD platform
  • Rotate keys regularly
  • Commit .env files with real credentials
  • Use production keys in development
  • Share API keys in public repositories
  • Hardcode secrets in source code

Run the doctor command to verify your configuration:

Terminal window
varitykit doctor

This checks:

  • Credential availability (auto-provided or manually set)
  • Network connectivity
  • API key validity
  • Project structure
  1. Check file name is exactly .env or .env.local
  2. Restart your development server after changes
  3. Verify no syntax errors in the file
  4. Check framework-specific prefixes (NEXT_PUBLIC_, VITE_, etc.)

Run varitykit doctor to diagnose. Credentials are auto-provided — if they fail, check your network connection.

Advanced: Using Your Own Auth Credentials

Varity manages these credentials automatically. Only use this if you need custom configuration.

Override the managed authentication credential by setting this variable:

.env.local
# Authentication — get from https://dashboard.privy.io
NEXT_PUBLIC_PRIVY_APP_ID=your_privy_app_id

Storage is handled automatically by Varity — no credentials needed.

When this variable is set, the SDK uses your own Privy app instead of the managed one.