Environment Variables

QuickDapp uses environment variables for configuration, loaded from .env files based on NODE_ENV. The base .env file is loaded first, then environment-specific overrides (.env.development, .env.test, .env.production), and finally .env.local for developer overrides.

Required Variables

Every QuickDapp deployment needs these core variables:

VariableDescription
DATABASE_URLPostgreSQL connection string. See Database for schema and query patterns.
SESSION_ENCRYPTION_KEYSecret key for JWT signing and OAuth state encryption. Must be at least 32 characters.
API_URLBase URL for the API (e.g., http://localhost:3000 or https://api.yourdomain.com).
DATABASE_URL=postgresql://user:password@host:5432/database
SESSION_ENCRYPTION_KEY=your_min_32_characters_key
API_URL=http://localhost:3000

Server Configuration

VariableDefaultDescription
WEB_ENABLEDtrueEnable the web server. Set to false for worker-only processes.
HOSTlocalhostServer bind address. Use 0.0.0.0 in containers.
PORT3000Server port number.
WORKER_COUNT1Number of worker processes. Set to "cpus" to match CPU cores.
STATIC_ASSETS_FOLDERCustom path for static assets (overrides default).
LOG_LEVELinfoLogging verbosity: trace, debug, info, warn, error.
WORKER_LOG_LEVELinfoLog level for worker processes.
WEB_ENABLED=true
HOST=localhost
PORT=3000
WORKER_COUNT=1
LOG_LEVEL=info
WORKER_LOG_LEVEL=info

OAuth Providers

Configure OAuth authentication by setting client credentials for each provider. Leave empty to disable a provider. See Authentication for implementation details.

VariableDescription
OAUTH_CALLBACK_BASE_URLBase URL for OAuth callbacks (e.g., http://localhost:3000).
OAUTH_GOOGLE_CLIENT_IDGoogle OAuth client ID.
OAUTH_GOOGLE_CLIENT_SECRETGoogle OAuth client secret.
OAUTH_FACEBOOK_CLIENT_IDFacebook OAuth app ID.
OAUTH_FACEBOOK_CLIENT_SECRETFacebook OAuth app secret.
OAUTH_GITHUB_CLIENT_IDGitHub OAuth app client ID.
OAUTH_GITHUB_CLIENT_SECRETGitHub OAuth app client secret.
OAUTH_X_CLIENT_IDX (Twitter) OAuth client ID.
OAUTH_X_CLIENT_SECRETX (Twitter) OAuth client secret.
OAUTH_TIKTOK_CLIENT_KEYTikTok OAuth client key.
OAUTH_TIKTOK_CLIENT_SECRETTikTok OAuth client secret.
OAUTH_LINKEDIN_CLIENT_IDLinkedIn OAuth client ID.
OAUTH_LINKEDIN_CLIENT_SECRETLinkedIn OAuth client secret.

Email (Mailgun)

Configure transactional email delivery via Mailgun. When not configured, emails are logged to the console instead of sent. See Mailgun for usage.

VariableDescription
MAILGUN_API_KEYMailgun API key for sending emails.
MAILGUN_API_ENDPOINTMailgun API endpoint. Set for EU region: https://api.eu.mailgun.net.
MAILGUN_FROM_ADDRESSSender email address (e.g., [email protected]). Domain is extracted automatically.

Error Tracking (Sentry)

Configure Sentry for error tracking and performance monitoring. See Sentry for integration details.

VariableDefaultDescription
SENTRY_DSNSentry DSN for the main server process.
SENTRY_WORKER_DSNSentry DSN for worker processes (can be same or different project).
SENTRY_TRACES_SAMPLE_RATE1.0Fraction of requests to trace (0.0 to 1.0).
SENTRY_PROFILE_SESSION_SAMPLE_RATE1.0Fraction of sessions to profile (0.0 to 1.0).

WebSocket Configuration

Control real-time connection limits. See WebSockets for the connection lifecycle and message types.

VariableDefaultDescription
SOCKET_MAX_CONNECTIONS_PER_USER5Maximum concurrent WebSocket connections per user.
SOCKET_MAX_TOTAL_CONNECTIONS10000Global limit for all WebSocket connections.

Client-Visible Variables

These variables are safe to expose in the frontend bundle:

  • APP_NAME, APP_VERSION, NODE_ENV
  • API_URL
  • SENTRY_DSN

Server-side secrets like database credentials, private keys, and OAuth secrets remain server-only. See src/shared/config/client.ts for the client configuration and src/shared/config/server.ts for the full server configuration.


Web3 Variant Variables

WEB3_ENABLED=true
WEB3_SERVER_WALLET_PRIVATE_KEY=0xYourWalletPrivateKey
WEB3_SUPPORTED_CHAINS=anvil
WEB3_WALLETCONNECT_PROJECT_ID=your_walletconnect_project_id
WEB3_ALLOWED_SIWE_ORIGINS=http://localhost:3000
WEB3_FACTORY_CONTRACT_ADDRESS=0xYourContractAddress

Per-Chain RPC Endpoints

Server-side blockchain operations use chain-specific RPC variables:

VariableDescription
WEB3_ANVIL_RPCRPC URL for local Anvil/Foundry development network.
WEB3_MAINNET_RPCRPC URL for Ethereum mainnet.
WEB3_SEPOLIA_RPCRPC URL for Sepolia testnet.
WEB3_BASE_RPCRPC URL for Base network.
WEB3_ANVIL_RPC=http://localhost:8545
WEB3_MAINNET_RPC=https://eth.llamarpc.com
WEB3_SEPOLIA_RPC=https://rpc.sepolia.org
WEB3_BASE_RPC=https://mainnet.base.org

Client-side uses viem's built-in public RPCs for each chain.

Web3 Client-Visible Variables

These Web3 variables are also exposed to the frontend bundle:

  • WEB3_ENABLED, WEB3_SUPPORTED_CHAINS, WEB3_WALLETCONNECT_PROJECT_ID, WEB3_FACTORY_CONTRACT_ADDRESS