Skip to main content

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

string
required
Identifies which DAO configuration to load.Supported values: ens, uniswap, optimism, derive, cyber, xai, boost, scroll, linea, etherfi, b3, protocol-guildExample:
Impact: Controls the entire tenant configuration including contracts, UI theme, and features.

NEXT_PUBLIC_AGORA_INSTANCE_TOKEN

string
required
Token symbol for the DAO instance.Example:
Usage: Displayed throughout the UI when referring to the governance token.

NEXT_PUBLIC_AGORA_ENV

string
required
Determines production vs development environment.Values: prod for production, dev or any other value for developmentExample:
Controls:
  • 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

string
required
Alchemy API key for client-side blockchain RPC access.Example:
This key is public but sensitive. Must be domain-whitelisted in your Alchemy dashboard to prevent abuse.
Usage: Used for client-side chain interactions (wagmi, Web3Provider, hooks)Fallback: Can be overridden by NEXT_PUBLIC_FORK_NODE_URL for local development

NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID

string
required
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

string
PostgreSQL database connection string or environment selector.Special values:
  • "dev" - Uses development database URLs
  • "prod" - Uses production database URLs
  • Direct URL - Overrides environment-specific URLs
Format:
Fallback: If not set, uses environment-specific URLs below

READ_WRITE_WEB2_DATABASE_URL_PROD / READ_WRITE_WEB2_DATABASE_URL_DEV

string
required
Database for user-generated content (profiles, settings, delegate statements).Example:
Usage: Read-write operations for web2 dataSelection: Based on NEXT_PUBLIC_AGORA_ENV value

READ_ONLY_WEB3_DATABASE_URL_PROD / READ_ONLY_WEB3_DATABASE_URL_DEV

string
required
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

string
Private key for sponsoring gas fees in relay transactions.Format: Hex string without 0x prefixExample:
CRITICAL - Never expose in client code or logs. Server-side only at /api/v1/relay/*
Usage: Enables users to delegate/vote without paying gas

EAS_SENDER_PRIVATE_KEY

string
Private key for Ethereum Attestation Service operations.Example:
CRITICAL - Server-side only. Used for creating on-chain attestations for verified delegates.

JWT_SECRET

string
required
Secret for signing JWT tokens.Example:
Must be strong and unique per environment. Minimum 32 characters recommended.
Usage: User session management and authentication

Network & RPC Configuration

SERVERSIDE_ALCHEMY_ID_PROD / SERVERSIDE_ALCHEMY_ID_DEV

string
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
Auto-detection: Code automatically uses the right key based on execution context and environmentFallback: Falls back to NEXT_PUBLIC_ALCHEMY_ID if not set

NEXT_PUBLIC_FORK_NODE_URL

string
Override RPC endpoint for development/testing.Example:
Use cases:
  • Local Anvil/Hardhat forks
  • Testing contract interactions
  • Debugging transactions
Priority: Takes precedence over Alchemy when set

NEXT_PUBLIC_CONDUIT_KEY

string
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

string
required
Template for DAO-specific data endpoints.Format:
Variables: {TENANT_NAMESPACE} is replaced with instance nameUsage: Fetches proposal details, voting data

External Services

Tenderly (Transaction Simulation)

string
Tenderly username for transaction simulation.
string
Tenderly project name.
string
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)

string
Pinata JWT token (preferred method).
string
Pinata API key (legacy).
string
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 pair

Etherscan

string
Etherscan API key for contract verification and ABI fetching.Example:
Usage:
  • Fetches contract ABIs dynamically
  • Decodes transaction data
  • Verifies contract source code
Free tier has rate limits. Monitor usage to avoid hitting limits.

GitHub PR Bot

string
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 repository

Deployment Configuration

NEXT_PUBLIC_AGORA_BASE_URL

string
required
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

string
Application root path for subpath deployments.Default: /Example:
Use case: Deploying under a subpath instead of root domain

NODE_ENV

string
Node.js environment mode (automatically set by Next.js).Values: production, development, test
Automatically set by next dev (development) and next build (production). Do not set manually.
Impact:
  • 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.
string
Deployment environment: production, preview, or development
string
Deployment region
string
Git commit SHA for the deployment
string
Deployment URL
Usage: OpenTelemetry tracing attributes for monitoring

Feature Flags

Toggle optional features on or off.

NEXT_PUBLIC_SIWE_ENABLED

boolean
Enable Sign-In with Ethereum.Values: "true" to enable, any other value disablesExample:
Default: DisabledImpact: Allows wallet-based authentication

NEXT_PUBLIC_ENABLE_BI_METRICS_CAPTURE

boolean
Enable analytics event tracking.Values: "true" to enableExample:
Default: DisabledRelated: Requires NEXT_PUBLIC_AGORA_API_KEYImpact: Sends usage metrics to analytics endpoint

NEXT_PUBLIC_MUTE_QUERY_LOGGING

boolean
Disable database query logging.Values: "true" to disable loggingExample:
Default: Logging enabledUse case: Reduce noise in development logs

Monitoring & Analytics

DataDog

string
DataDog API key.
string
DataDog application key.
boolean
Toggle DataDog metrics collection.Example:
Default: Disabled
Both DD keys must be set for this to work.
Usage: Sends application metrics and alerts to DataDog

Advanced Features

AWS Services

string
AWS access key ID.
string
AWS secret access key.Example:
Use IAM roles in production when possible for better security.
Usage:
  • DynamoDB access
  • S3 bucket operations

STORAGE_BUCKET_URL

string
Base URL for storage bucket.Format: Full URL with trailing slashExample:
Usage: Fetches contract ABIs from backup storage

Smart Accounts

string
Alchemy API key for smart account features.Example:
Note: Separate from regular API keyGet it from: Alchemy dashboardUsage: Enables account abstraction features
string
Secret for paymaster service integration.Usage: Enables sponsored transactions

Environment Setup Examples

Minimum Required for Development

Production Configuration

Security Best Practices

Follow these security guidelines to protect your deployment:
  1. Never commit .env files with real credentials to version control
  2. Use different keys for development and production
  3. Rotate private keys regularly, especially gas sponsor and EAS keys
  4. Monitor API key usage in provider dashboards (Alchemy, Pinata, etc.)
  5. Use environment-specific databases to prevent accidental data corruption
  6. Keep server-side keys out of NEXT_PUBLIC_* variables
  7. Whitelist domains in Alchemy dashboard for NEXT_PUBLIC_ALCHEMY_ID
  8. 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