Overview
Dub requires various environment variables for configuration. This page provides a comprehensive reference for all available options.All environment variables should be set in the
.env file in the apps/web directory.Required Variables
These variables are essential for Dub to function properly.Application Configuration
The name of your application.Default:
DubThe primary domain where your Dub instance is hosted.Example:
dub.coThe domain used for shortened links.Example:
dub.shAnalytics & Tracking
Your Tinybird API authentication token. Required for analytics functionality.Get your token at: Tinybird Auth Tokens
The Tinybird API endpoint for your region.Default:
https://api.tinybird.coRegions:- US East:
https://api.tinybird.co - EU:
https://api.eu-central-1.tinybird.co - US West:
https://api.us-west-2.tinybird.co
Domain Management
Your Vercel team ID.
Vercel authentication bearer token for API access.
Redis & Caching
Upstash Redis REST API token.
Background Jobs & Queues
Current QStash signing key for webhook verification.
Next QStash signing key for key rotation.
Database
MySQL database connection URL.Format:
mysql://username:password@host:port/databaseGet started with PlanetScale: Connect Node.js AppPlanetScale HTTP proxy URL for local development.Local development:
Authentication
Secret key for NextAuth.js session encryption. Must be a random 32+ character string.Generate one at: generate-secret.vercel.app/32
The canonical URL of your site. Required for localhost development.Production: Auto-detected by VercelLocal development:
Email Configuration
Resend webhook secret for email event verification.
SMTP server hostname (recommended for local development).Local development with MailHog:
SMTP server port.Default:
1025 (MailHog)SMTP authentication username.
SMTP authentication password.
Secret for email unsubscribe token generation. Falls back to
NEXTAUTH_SECRET if not set.Optional Variables
These variables enable additional features and integrations.Payments & Subscriptions
Stripe publishable key for client-side payment forms.
Stripe secret key for server-side operations.
Stripe webhook secret for payment event verification.
Stripe Connect webhook secret.
Stripe Connect v2 webhook secret.
Stripe App webhook secret.
OAuth Providers
Google OAuth client secret.
GitHub OAuth app client secret.
Framer OAuth client ID for Framer login.
Framer OAuth client secret.
Edge Configuration
Vercel Edge Config connection string for admin features like rate limiting and user banning.Create one: Vercel Edge Config
If you don’t need admin features, you can remove
lib/edge-config.ts and all references to EDGE_CONFIG from the codebase.Vercel Edge Config ID.
Link Import Tools
Bitly OAuth client ID for importing Bitly links.Apply for API access: Bitly DevelopersLearn more: Migration Assistants
Bitly OAuth client secret.
Media & Assets
S3-compatible storage access key ID.
S3-compatible storage secret access key.
S3-compatible storage endpoint URL.
Base URL for accessing stored assets.
S3 bucket name for public assets.
S3 bucket name for private assets.
Monitoring & Logging
Axiom dataset name for storing logs.
Slack webhook URL for cron job notifications.
You can remove these by deleting references to
DUB_SLACK_HOOK_CRON and DUB_SLACK_HOOK_LINKS from the codebase.Slack webhook URL for link-related notifications.
Customer Support
Plain webhook secret for event verification.
AI Features
Anthropic API key for AI-powered features.
Development Tools
Integrations
Shopify App webhook secret.
Internal Use Variables
These variables are used internally by Dub.co and are not required for self-hosted installations.NEXT_PUBLIC_IS_DUB- Enables Dub.co specific featuresCRON_SECRET- Secret for authenticating cron jobsSLACK_CLIENT_ID/SLACK_CLIENT_SECRET/SLACK_SIGNING_SECRET- Slack integrationDYNADOT_API_KEY/DYNADOT_BASE_URL/DYNADOT_COUPON- Domain registrationTWITTER_CLIENT_ID/TWITTER_CLIENT_SECRET- Twitter verificationTIKTOK_CLIENT_ID/TIKTOK_CLIENT_SECRET- TikTok verificationLINKEDIN_CLIENT_ID/LINKEDIN_CLIENT_SECRET- LinkedIn verificationYOUTUBE_API_KEY- YouTube verificationSCRAPECREATORS_API_KEY- Creator scraping servicePAYPAL_CLIENT_ID/PAYPAL_CLIENT_SECRET/PAYPAL_WEBHOOK_ID- PayPal integrationSTRIPE_APP_SECRET_KEY_TEST/STRIPE_APP_SECRET_KEY/STRIPE_APP_SECRET_KEY_SANDBOX- Stripe app keysFIRECRAWL_API_KEY- Program lander generationSINGULAR_WEBHOOK_TOKEN- Singular eventsHUBSPOT_CLIENT_ID/HUBSPOT_CLIENT_SECRET- HubSpot integration
Environment File Template
Here’s a minimal.env template to get started:
Validation
To verify your environment configuration:- Check that all required variables are set
- Test database connectivity with
pnpm prisma:studio - Verify Redis connection by starting the dev server
- Test email delivery by signing up for an account
Missing required environment variables will cause the application to fail at startup with clear error messages indicating which variables are missing.