Database Configuration
Core database connections required for Databuddy to function.PostgreSQL
PostgreSQL connection string for user data, configuration, and authentication.Format:
postgres://username:password@host:port/databaseExample:ClickHouse
ClickHouse connection string for analytics events and metrics.Format: Leave password empty if ClickHouse has no authentication configured.
http://username:password@host:port/databaseExample:Redis
Redis connection string for caching and session management.Format:
redis://[:password@]host:port[/database]Examples:Application Configuration
Environment Mode
Runtime environment mode.Options:
development- Local development (enables debug logging, disables some integrations)production- Production deployment (JSON logs, all features enabled)test- Test environment
Application URLs
Base URL where your Databuddy dashboard is hosted.Used for:
- OAuth callback URLs
- Email verification links
- Password reset links
API server URL accessible from the browser.Note: The
NEXT_PUBLIC_ prefix makes this available to client-side code.Examples:Authentication
Better Auth Secret
Secret key for signing JWTs and encrypting session data.Generate a secure secret:Example:
OAuth Providers
GitHub OAuth application client ID.Setup:
- Go to https://github.com/settings/developers
- Create a new OAuth app
- Set callback URL to
{BETTER_AUTH_URL}/api/auth/callback/github
GitHub OAuth application client secret.
Google OAuth 2.0 client ID.Setup:
- Go to https://console.cloud.google.com/apis/credentials
- Create OAuth 2.0 credentials
- Add authorized redirect URI:
{BETTER_AUTH_URL}/api/auth/callback/google
Google OAuth 2.0 client secret.
Email Configuration
Resend API key for sending transactional emails.Used for:
- Email verification
- Password reset
- Team invitations
- Usage alerts
Email functionality is optional but highly recommended for production deployments.
Storage Configuration
Cloudflare R2 access key ID for storing organization images.Example:
Image uploads are optional. Organizations will function without custom images if not configured.
Cloudflare R2 secret access key.
R2 bucket name for file storage.
R2 endpoint URL for your account.
AI Features (Optional)
OpenRouter API key for AI assistant features.Used for:
- Analytics insights and recommendations
- Natural language queries
- Automated report generation
AI features are entirely optional. Core analytics work without this configuration.
External Integrations (Optional)
Domain Ranking
OpenPageRank API key for domain authority metrics.Get an API key: https://www.domcop.com/openpagerank/Example:
Not required for basic analytics operations.
Background Jobs
Upstash QStash token for scheduled background jobs.Used for:
- Scheduled reports
- Data exports
- Cleanup tasks
Content Management
Marble CMS workspace key for blog functionality.Example:
Only needed if using the built-in blog feature.
Marble CMS API endpoint.
Logging Configuration (Optional)
Logtail source token for centralized logging.Example:
Logtail integration is automatically disabled when
NODE_ENV=development.Logtail ingestion endpoint.
Advanced Configuration
Security
Autumn.js secret key for request signing.Example:
Disabled when
NODE_ENV=development.Event Streaming (Optional)
For high-scale deployments using Redpanda:Host/IP where Redpanda is accessible.Example:
Redpanda logging verbosity.Options:
error, warn, info, debug, traceRedpanda SASL authentication username.
Redpanda SASL authentication password.
Vector (data pipeline) Kafka username for Redpanda integration.
Vector Kafka password.
Example Configuration Files
Development Environment
.env.development
Production Environment
.env.production
Environment Variable Validation
Databuddy validates required environment variables on startup. Missing required variables will prevent the application from starting with clear error messages. Required variables:DATABASE_URLCLICKHOUSE_URLREDIS_URLBETTER_AUTH_URLBETTER_AUTH_SECRETNEXT_PUBLIC_API_URL
RESEND_API_KEYGITHUB_CLIENT_ID+GITHUB_CLIENT_SECRET(or Google OAuth)R2_*variables for image uploads
Security Best Practices
Use different secrets for each environment
Development, staging, and production should have completely different:
- Database passwords
- Auth secrets
- API keys
Rotate secrets regularly
Update sensitive credentials periodically:
BETTER_AUTH_SECRETevery 90 days- Database passwords every 180 days
- API keys when team members leave
Next Steps
Database Setup
Initialize PostgreSQL and ClickHouse
Configuration
Advanced configuration and tuning