Environment Variables
Budget Bee uses environment variables for configuration. This guide covers all available variables and their purposes.Getting Started
Copy the example environment file:.env with your configuration.
Application URLs
Core application URL configuration:URL for the marketing/landing siteExample values:
- Development:
http://localhost:3001 - Production:
https://budget-bee.site
URL for the main applicationExample values:
- Development:
http://localhost:3000 - Production:
https://app.budget-bee.site
This is used for authentication callbacks and email links.
URL for the currency conversion API serviceExample values:
- Development:
http://localhost:8787 - Production:
https://currency-api.budget-bee.site
URL for the PostgREST API endpointExample values:
- Development:
http://localhost:5101 - Production:
https://api.budget-bee.site
Cloudinary URL for image uploads (optional)Format:
cloudinary://api_key:api_secret@cloud_nameAuthentication
Better Auth configuration for authentication:Secret key for Better Auth encryption and signingGeneration:
OAuth Providers
Google OAuth client ID for Google Sign-InHow to get:
- Go to Google Cloud Console
- Create or select a project
- Enable Google+ API
- Create OAuth 2.0 credentials
- Add authorized redirect URIs:
http://localhost:3000/api/auth/callback/google(development)https://your-domain.com/api/auth/callback/google(production)
Google OAuth client secret (paired with client ID)
Google Analytics measurement ID for tracking (optional)Format:
G-XXXXXXXXXXEmail Configuration
Resend email service configuration:Resend API key for sending emailsHow to get:
- Sign up at resend.com
- Create an API key in the dashboard
- Copy the key (starts with
re_)
Resend is used for verification emails, password resets, and invitations.
Display name for email senderThis appears as the “From” name in emails.
Email address for sending emailsRequirements:
- Must be verified in Resend
- Should be a no-reply or support email
[email protected]Database Configuration
PostgreSQL database connection settings:Name of the PostgreSQL database
Main PostgreSQL user for application connections
PostgreSQL server hostname or IP addressExample values:
- Development:
localhost - Docker:
postgres(service name) - Production:
your-db-host.com
PostgreSQL server portDefault PostgreSQL port is 5432, but can be customized.
Password for the main PostgreSQL user
Special Database Users
Budget Bee uses separate database users for different operations:Database user for Better Auth operationsThis user has permissions to manage:
- users table
- sessions table
- accounts table
- verifications table
- organizations, members, invitations
Password for the auth_admin user
Database user for subscription managementThis user has permissions to:
- Read users table
- Manage app_subscriptions table
Password for the subscription_admin user
PostgREST Configuration
JWT secret for PostgREST API authenticationGeneration:
This should be different from BETTER_AUTH_SECRET.
Billing & Subscriptions
Polar integration for subscription billing:Polar API access token for subscription managementHow to get:
- Sign up at polar.sh
- Create an organization
- Generate an API token in settings
Secret for verifying Polar webhook signaturesFound in Polar dashboard under Webhooks settings.
Polar Product IDs
Product ID for Pro monthly subscriptionCreate products in Polar dashboard and copy their IDs.
Product ID for Pro yearly subscription
Product ID for Teams monthly subscription
Product ID for Teams yearly subscription
Development & Testing
User ID for testing in development
Complete Example
Environment-Specific Configuration
Development
Production
Docker Compose
Security Best Practices
Use Strong Secrets
Generate secrets with
openssl rand -base64 32 or similar tools.Different Per Environment
Use different secrets for development, staging, and production.
Never Commit
Add
.env to .gitignore. Never commit secrets to version control.Rotate Regularly
Rotate secrets periodically, especially after team member changes.
Validation
Budget Bee validates environment variables on startup. Missing required variables will cause startup failures:Troubleshooting
Application won't start
Application won't start
Check:
- All required environment variables are set
- No typos in variable names
- Values are properly quoted if they contain special characters
- .env file is in the correct directory
Authentication not working
Authentication not working
Verify:
- BETTER_AUTH_SECRET is set and not empty
- NEXT_PUBLIC_APP_URL is correct and accessible
- OAuth client IDs and secrets are correct
- Callback URLs are properly configured in OAuth provider
Database connection failed
Database connection failed
Ensure:
- Database server is running
- POSTGRES_HOST and POSTGRES_PORT are correct
- POSTGRES_USER has proper permissions
- POSTGRES_PASSWORD is correct
- Database POSTGRES_DATABASE exists
Emails not sending
Emails not sending
Check:
- RESEND_API_KEY is valid and not expired
- SMTP_MAIL is verified in Resend dashboard
- API key has send permissions
- Check Resend dashboard for delivery logs
Next Steps
Database Setup
Configure PostgreSQL with users and roles.
Authentication Setup
Configure Better Auth and OAuth providers.

