Environment Variables
Varity manages most credentials automatically. You only need to set environment variables for services you manage yourself.
Varity App Configuration
Section titled “Varity App Configuration”# Your Varity App ID (from developer portal)NEXT_PUBLIC_VARITY_APP_ID=your-app-idOptional Variables
Section titled “Optional Variables”These variables are only needed for specific use cases:
| Variable | Required For | Default |
|---|---|---|
NEXT_PUBLIC_VARITY_APP_ID | App identity | Dev default |
VARITY_API_URL | Custom API endpoint | https://varity.app |
VARITY_API_KEY | API authentication | Auto-provided |
Example .env Files
Section titled “Example .env Files”# Varity SDK (optional — dev defaults work automatically)NEXT_PUBLIC_VARITY_APP_ID=your-app-idIn development, the SDK uses shared credentials automatically. No other variables are needed.
# Varity SDKNEXT_PUBLIC_VARITY_APP_ID=your-app-idVARITY_API_URL=https://varity.appVARITY_API_KEY=your_production_api_keyProduction credentials for authentication and storage are auto-provided by the CLI during deployment.
Framework-Specific Prefixes
Section titled “Framework-Specific Prefixes”Different frameworks require different prefixes for client-side variables:
| Framework | Prefix | Example |
|---|---|---|
| Next.js | NEXT_PUBLIC_ | NEXT_PUBLIC_VARITY_APP_ID |
| Vite | VITE_ | VITE_VARITY_APP_ID |
| Create React App | REACT_APP_ | REACT_APP_VARITY_APP_ID |
Security Best Practices
Section titled “Security Best Practices”- Use
.env.localfor local development (git-ignored) - Store production secrets in your CI/CD platform
- Rotate keys regularly
Don’t:
Section titled “Don’t:”- Commit
.envfiles with real credentials - Use production keys in development
- Share API keys in public repositories
- Hardcode secrets in source code
Verifying Configuration
Section titled “Verifying Configuration”Run the doctor command to verify your configuration:
varitykit doctorThis checks:
- Credential availability (auto-provided or manually set)
- Network connectivity
- API key validity
- Project structure
Troubleshooting
Section titled “Troubleshooting”Variables not loading
Section titled “Variables not loading”- Check file name is exactly
.envor.env.local - Restart your development server after changes
- Verify no syntax errors in the file
- Check framework-specific prefixes (
NEXT_PUBLIC_,VITE_, etc.)
Credentials not working
Section titled “Credentials not working”Run varitykit doctor to diagnose. Credentials are auto-provided — if they fail, check your network connection.
Advanced: Using Your Own Credentials
Varity manages these credentials automatically. Only use this if you need custom configuration.
Override managed credentials by setting these variables:
# Authentication — get from https://dashboard.privy.ioNEXT_PUBLIC_PRIVY_APP_ID=your_privy_app_id
# Storage — get from https://thirdweb.com/dashboardTHIRDWEB_CLIENT_ID=your_thirdweb_client_idTHIRDWEB_SECRET_KEY=your_thirdweb_secret_keyFramework-specific variants:
# Next.jsNEXT_PUBLIC_THIRDWEB_CLIENT_ID=your_client_id
# ViteVITE_THIRDWEB_CLIENT_ID=your_client_id
# Create React AppREACT_APP_THIRDWEB_CLIENT_ID=your_client_idWhen these are set, the SDK and CLI use your credentials instead of the managed ones.