Overview
Agora uses environment variables for all configuration. This guide provides comprehensive documentation for every environment variable with usage examples and best practices.Create a
.env.local file in your project root for local development. Never commit this file to version control.Critical Configuration (Required)
These variables are required for the application to start.NEXT_PUBLIC_AGORA_INSTANCE_NAME
Identifies which DAO configuration to load.Supported values: Impact: Controls the entire tenant configuration including contracts, UI theme, and features.
ens, uniswap, optimism, derive, cyber, xai, boost, scroll, linea, etherfi, b3, protocol-guildExample:NEXT_PUBLIC_AGORA_INSTANCE_TOKEN
Token symbol for the DAO instance.Example:Usage: Displayed throughout the UI when referring to the governance token.
NEXT_PUBLIC_AGORA_ENV
Determines production vs development environment.Values: Controls:
prod for production, dev or any other value for developmentExample:- Which database URLs are used (READ_WRITE_WEB2_DATABASE_URL_PROD vs _DEV)
- Contract addresses (mainnet vs testnet)
- Feature toggles and safety checks
- API endpoints (prod vs dev environments)
- EAS schema selection
- Snapshot space selection
NEXT_PUBLIC_ALCHEMY_ID
Alchemy API key for client-side blockchain RPC access.Example:Usage: Used for client-side chain interactions (wagmi, Web3Provider, hooks)Fallback: Can be overridden by
NEXT_PUBLIC_FORK_NODE_URL for local developmentNEXT_PUBLIC_WALLETCONNECT_PROJECT_ID
WalletConnect v2 project identifier.Example:Get credentials: WalletConnect CloudUsage: Enables wallet connections via WalletConnect protocol
Database Configuration
Agora uses a dual-database architecture for optimal performance.DATABASE_URL
PostgreSQL database connection string or environment selector.Special values:Fallback: If not set, uses environment-specific URLs below
"dev"- Uses development database URLs"prod"- Uses production database URLs- Direct URL - Overrides environment-specific URLs
READ_WRITE_WEB2_DATABASE_URL_PROD / READ_WRITE_WEB2_DATABASE_URL_DEV
Database for user-generated content (profiles, settings, delegate statements).Example:Usage: Read-write operations for web2 dataSelection: Based on
NEXT_PUBLIC_AGORA_ENV valueREAD_ONLY_WEB3_DATABASE_URL_PROD / READ_ONLY_WEB3_DATABASE_URL_DEV
Database for blockchain indexed data.Example:Usage: Read-only operations for web3 data (proposals, votes, delegates)
This separation allows for optimized querying of blockchain data without affecting user-generated content operations.
Authentication & Security
Critical security credentials for various features.GAS_SPONSOR_PK
Private key for sponsoring gas fees in relay transactions.Format: Hex string without 0x prefixExample:Usage: Enables users to delegate/vote without paying gas
EAS_SENDER_PRIVATE_KEY
Private key for Ethereum Attestation Service operations.Example:
JWT_SECRET
Secret for signing JWT tokens.Example:Usage: User session management and authentication
Network & RPC Configuration
SERVERSIDE_ALCHEMY_ID_PROD / SERVERSIDE_ALCHEMY_ID_DEV
Alchemy API keys for server-side blockchain RPC access.Example:Benefits:
- Private - never exposed to browser
- No domain restrictions needed
- Prevents leaked client keys from server-side abuse
NEXT_PUBLIC_ALCHEMY_ID if not setNEXT_PUBLIC_FORK_NODE_URL
Override RPC endpoint for development/testing.Example:Use cases:
- Local Anvil/Hardhat forks
- Testing contract interactions
- Debugging transactions
NEXT_PUBLIC_CONDUIT_KEY
API key for Conduit RPC (Derive chain).Example:Required for: Derive tenant onlyUsage: Constructs RPC URLs for Derive mainnet/testnet (
https://rpc.derive.xyz/{key})DAONODE_URL_TEMPLATE
Template for DAO-specific data endpoints.Format:Variables:
{TENANT_NAMESPACE} is replaced with instance nameUsage: Fetches proposal details, voting dataExternal Services
Tenderly (Transaction Simulation)
Tenderly username for transaction simulation.
Tenderly project name.
Tenderly access key.Example:Get credentials: Tenderly DashboardUsage: Simulates proposal execution before voting
All three variables must be set for simulation to work. Features disabled if missing.
Pinata (IPFS Storage)
Pinata JWT token (preferred method).
Pinata API key (legacy).
Pinata secret API key (legacy).Example:Get credentials: Pinata CloudUsage: Stores proposal descriptions and supporting documents on IPFSPriority:
PINATA_JWT preferred over API key/secret pairEtherscan
Etherscan API key for contract verification and ABI fetching.Example:Usage:
- Fetches contract ABIs dynamically
- Decodes transaction data
- Verifies contract source code
GitHub PR Bot
GitHub token for creating pull requests.Example:Permissions: Requires repo write accessUsage: Creates PRs for ENS executable proposalsRelated: Works with
ENVIRONMENT variable to target correct repositoryDeployment Configuration
NEXT_PUBLIC_AGORA_BASE_URL
Application base URL for metadata and API calls.Format: Full URL including protocolExample:Usage: Used in wallet connection metadata and API calls
NEXT_PUBLIC_AGORA_ROOT
Application root path for subpath deployments.Default: Use case: Deploying under a subpath instead of root domain
/Example:NODE_ENV
Node.js environment mode (automatically set by Next.js).Values: Impact:
production, development, testAutomatically set by
next dev (development) and next build (production). Do not set manually.- Production mode enables optimizations
- Development mode enables hot reload
- Controls Prisma client behavior and caching
Vercel Environment Variables
These variables are automatically set by Vercel. Do not set manually.
Deployment environment:
production, preview, or developmentDeployment region
Git commit SHA for the deployment
Deployment URL
Feature Flags
Toggle optional features on or off.NEXT_PUBLIC_SIWE_ENABLED
Enable Sign-In with Ethereum.Values: Default: DisabledImpact: Allows wallet-based authentication
"true" to enable, any other value disablesExample:NEXT_PUBLIC_ENABLE_BI_METRICS_CAPTURE
Enable analytics event tracking.Values: Default: DisabledRelated: Requires
"true" to enableExample:NEXT_PUBLIC_AGORA_API_KEYImpact: Sends usage metrics to analytics endpointNEXT_PUBLIC_MUTE_QUERY_LOGGING
Disable database query logging.Values: Default: Logging enabledUse case: Reduce noise in development logs
"true" to disable loggingExample:Monitoring & Analytics
DataDog
DataDog API key.
DataDog application key.
Toggle DataDog metrics collection.Example:Default: DisabledUsage: Sends application metrics and alerts to DataDog
Both DD keys must be set for this to work.
Advanced Features
AWS Services
AWS access key ID.
AWS secret access key.Example:Usage:
Use IAM roles in production when possible for better security.
- DynamoDB access
- S3 bucket operations
STORAGE_BUCKET_URL
Base URL for storage bucket.Format: Full URL with trailing slashExample:Usage: Fetches contract ABIs from backup storage
Smart Accounts
Alchemy API key for smart account features.Example:Note: Separate from regular API keyGet it from: Alchemy dashboardUsage: Enables account abstraction features
Secret for paymaster service integration.Usage: Enables sponsored transactions
Environment Setup Examples
Minimum Required for Development
Production Configuration
Security Best Practices
- Never commit
.envfiles with real credentials to version control - Use different keys for development and production
- Rotate private keys regularly, especially gas sponsor and EAS keys
- Monitor API key usage in provider dashboards (Alchemy, Pinata, etc.)
- Use environment-specific databases to prevent accidental data corruption
- Keep server-side keys out of
NEXT_PUBLIC_*variables - Whitelist domains in Alchemy dashboard for
NEXT_PUBLIC_ALCHEMY_ID - Use IAM roles in production instead of AWS access keys when possible
Next Steps
Setup Guide
Complete initial setup with these environment variables
Deployment
Deploy to production with proper configuration
Customization
Customize your tenant configuration
Architecture
Understand the system architecture