Overview
Voxora uses environment variables to configure both the web application and API server. This guide covers all available variables and their purposes.API Server Variables
Located inapps/api/.env
Server Configuration
Port number for the API server
Environment mode:
development, staging, or productionLogging level:
error, warn, info, debug, or verboseDatabase
MongoDB connection stringDevelopment:Production:
Maximum number of connections in the MongoDB connection pool
Redis Cache
Redis server hostname
Redis server port
Redis authentication password (optional for local dev)
Redis database number (0-15)
Authentication
Secret key for signing JWT tokensGenerate a secure secret:
JWT token expiration time (e.g.,
1h, 7d, 30d)Refresh token expiration time
CORS
Allowed origins for CORSSingle origin:Multiple origins:All origins (dev only):
Email (SMTP)
SMTP server hostname
- Development:
localhost(MailHog) - Production: Your SMTP provider
SMTP server port
- MailHog:
1025 - Gmail:
587 - SendGrid:
587
SMTP authentication username
SMTP authentication password
Use TLS/SSL for SMTP connection
Default sender email address
File Uploads
Directory for storing uploaded files
Maximum file size in bytes (default: 10MB)
Comma-separated list of allowed MIME types
Rate Limiting
Rate limit window in milliseconds (default: 15 minutes)
Maximum requests per window
Widget
CDN URL for serving widget assets (optional)
Comma-separated list of domains allowed to embed the widget
Web Application Variables
Located inapps/web/.env
API Configuration
Base URL for API requestsDevelopment:Production:
WebSocket server URL (usually same as API URL)
Widget
URL for the embeddable chat widget
Features
Enable analytics tracking
Enable browser notifications
Maximum file upload size (must match API setting)
Analytics
Google Analytics measurement ID
Sentry DSN for error tracking
Docker Environment
Variables indocker/docker-compose.dev.yml
Environment Templates
Development Template
Production Template
Best Practices
Never Commit Secrets
Add
.env files to .gitignoreUse Templates
Commit
.env.example as a referenceValidate on Startup
Check required variables exist
Document Changes
Update docs when adding variables
Validation Example
apps/api/src/config/env.js
Loading Environment Variables
Next.js
Next.js automatically loads.env* files:
.env- All environments.env.local- Local overrides (not committed).env.development- Development only.env.production- Production only
NEXT_PUBLIC_ are exposed to the browser.
Node.js (API)
Usedotenv package:
Security Considerations
Next Steps
Development Setup
Complete development guide
Docker Services
Managing local services
Deployment
Deploy to production
Security
Security best practices