Overview
Bounty uses environment variables for configuration. Create a.env file in your project root with the required variables.
Quick Setup
Required Variables
These variables are essential for Bounty to function:Database
Authentication
Secret key for Better Auth session encryption. Must be at least 32 characters.Generate with:
The full URL where your application is hosted.
- Development:
http://localhost:3000 - Production:
https://yourdomain.com
This URL is used for OAuth callbacks and must match your OAuth app configuration
GitHub OAuth
GitHub OAuth application client ID.Setup:
- Go to GitHub Developer Settings
- Click “OAuth Apps” → “New OAuth App”
- Set Authorization callback URL:
{BETTER_AUTH_URL}/api/auth/callback/github - Copy the Client ID
GitHub OAuth application client secret.
GitHub App
Your GitHub App slug (e.g.,
bountydotnew from github.com/apps/bountydotnew).Setup:- Go to GitHub Apps Settings
- Click “New GitHub App”
- Configure webhook URL:
{BETTER_AUTH_URL}/api/webhooks/github - Enable permissions: Issues (read/write), Pull requests (read/write)
- Copy the app slug from the URL
Numeric ID of your GitHub App (found in app settings).
GitHub App client ID (different from OAuth client ID).
GitHub App private key, base64 encoded.Setup:
- Generate private key in GitHub App settings
- Encode to base64:
- Set in environment:
GITHUB_APP_PRIVATE_KEY="LS0tLS1CRUdJTi..."
The key must be base64 encoded and include the full PEM format including headers
Secret for verifying GitHub webhook payloads.Generate with:Set this same value in your GitHub App webhook settings.
Redis Cache
Upstash Redis REST API URL.Setup:
- Create account at Upstash
- Create a new Redis database
- Copy the REST URL from database details
Upstash Redis REST API token (found in database details).
Application URLs
Public-facing base URL of your application.
- Development:
http://localhost:3000 - Production:
https://yourdomain.com
The
NEXT_PUBLIC_ prefix makes this variable available in client-side codeOptional Variables
These variables enable additional features:Discord Integration
Discord OAuth application client ID.Setup: Discord Developer Portal
Discord OAuth application client secret.
Discord server invite link (e.g.,
https://discord.gg/your_server).Discord webhook URL for general notifications.Setup: Server Settings → Integrations → Webhooks → New Webhook
Discord webhook URL specifically for bounty feed updates.
Discord webhook URL for user feedback submissions.
Payment Processing
Stripe
Stripe secret API key (starts with
sk_test_ or sk_live_).Setup: Stripe DashboardStripe publishable API key (starts with
pk_test_ or pk_live_).Same as
STRIPE_PUBLISHABLE_KEY but accessible in client-side code.Stripe webhook signing secret for Connect webhooks.Setup: Stripe Dashboard → Developers → Webhooks → Add endpointEndpoint URL:
{NEXT_PUBLIC_BASE_URL}/api/webhooks/stripeStripe Price ID for monthly Bounty Pro subscription.
Stripe Price ID for annual Bounty Pro subscription.
Autumn (Alternative Payment Processor)
Autumn API base URL.Default:
https://api.useautumn.com/v1Autumn secret API key (starts with
am_sk_test_ or am_sk_live_).Setup: Autumn DashboardURL to redirect users after successful payment.Example:
http://localhost:3000/successURL to redirect users after cancelled payment.Example:
http://localhost:3000/billingAnalytics & Monitoring
PostHog project API key.Setup: PostHog Dashboard → Project Settings → API KeysStarts with
phc_PostHog API host URL.US:
EU:
https://us.i.posthog.comEU:
https://eu.i.posthog.comSentry Data Source Name for error tracking.Setup: Sentry Dashboard → Settings → Client Keys (DSN)
Sentry authentication token for source map uploads.Setup: Sentry Dashboard → Settings → Auth TokensStarts with
sntrys_Sentry project slug (e.g.,
javascript-nextjs).Sentry organization slug.
CMS & Content
Marble CMS webhook verification secret.Setup: Marble Dashboard → Workspace → API Keys
Alternative Marble webhook secret (legacy, same as
MARBLE_WEBHOOK_SECRET).Security & Rate Limiting
Secret for authenticating cron job requests.Generate with:Used in Vercel cron jobs (see
vercel.json).Feature Flags
Enable early access mode (restricts app to invited users only).Values:
"true"- Early access enabled (default)"false"- Fully public, no access restrictions
"false" on launch day to make the app publicly accessible.Additional GitHub
Personal GitHub access token (optional, for enhanced API limits).Setup: GitHub Settings → Developer settings → Personal access tokens → Generate new token
Environment-Specific Configuration
Development
Production
Validation
Bounty uses @t3-oss/env-nextjs for environment variable validation. If required variables are missing, the application will fail to start with a detailed error message.Security Best Practices
Secret Generation
Always use cryptographically secure random values:
Separate Environments
Use different credentials for dev, staging, and production environments.
Secret Rotation
Regularly rotate API keys and secrets, especially after team member changes.
Access Control
Limit access to environment variables using your deployment platform’s IAM features.
Troubleshooting
Application won't start
Application won't start
- Check that all required variables are set
- Verify DATABASE_URL format is correct
- Ensure secrets are properly encoded (no extra whitespace)
- Check for syntax errors in .env file
Database connection fails
Database connection fails
- Verify DATABASE_URL includes
?sslmode=require - URL-encode special characters in username/password
- Check database is accessible from your network
- Ensure PostgreSQL version is 14 or higher
OAuth redirect errors
OAuth redirect errors
- Verify BETTER_AUTH_URL matches OAuth app callback URL
- Check callback URL format:
{BETTER_AUTH_URL}/api/auth/callback/github - Ensure URL has no trailing slash
- Confirm OAuth app is not in suspended state
GitHub webhooks not working
GitHub webhooks not working
- Verify GITHUB_WEBHOOK_SECRET matches GitHub App settings
- Check webhook URL is publicly accessible
- Ensure webhook permissions are correctly set
- Review webhook delivery logs in GitHub App settings
Next Steps
Database Setup
Configure PostgreSQL and run database migrations