Environment Variables
Complete reference for all Arivu environment variables — MongoDB, authentication, AI, email, X integration, and admin configuration.
All configuration is controlled through environment variables in the .env file. Copy .env.example to .env and update values for your environment.
Admin UI Configuration
API keys for Gemini AI, X (Twitter), and Resend Email can also be configured through the Settings → API Keys panel in the web UI. This requires an admin account.
- DB overrides take precedence over environment variables
- Keys are encrypted at rest (Fernet) in MongoDB
- Changes take effect immediately — no server restart required
- Removing a DB override reverts to the
.envvalue
To use: set ADMIN_EMAILS=your-email@example.com in .env, then navigate to Settings → API Keys after logging in.
Required Variables
MONGO_URL
MongoDB connection string.
# Docker Compose (default)
MONGO_URL=mongodb://admin:changeme123@mongodb:27017/
# Local development
MONGO_URL=mongodb://localhost:27017/
# Managed MongoDB
MONGO_URL=mongodb+srv://user:pass@cluster.mongodb.net/
DB_NAME
MongoDB database name. Default: arivu_db.
DB_NAME=arivu_db
SECRET_KEY
JWT token signing key for authentication. Generate with:
openssl rand -hex 32
Changing this value invalidates all existing user sessions.
GEMINI_API_KEY
Google Gemini API key for all AI features: summaries, highlights, auto-tagging, knowledge graph, content intelligence, and analytics insights.
Get your key from Google AI Studio.
Free tier: 60 requests/minute. Monitor usage in the Google Cloud Console.
Security & Access
CORS_ORIGINS
Allowed origins for Cross-Origin Resource Sharing. Comma-separated list.
# Development
CORS_ORIGINS=*
# Production (restrict to your domain)
CORS_ORIGINS=https://yourdomain.com,https://www.yourdomain.com
Never use * in production.
ADMIN_EMAILS
Comma-separated email addresses with admin access. Admins can access the API Keys configuration UI and system health panel.
ADMIN_EMAILS=admin@example.com,ops@example.com
SIGNUPS_ENABLED
Enable or disable new user registration. Default: true.
# Open registration
SIGNUPS_ENABLED=true
# Invite-only mode
SIGNUPS_ENABLED=false
Email (Resend)
RESEND_API_KEY
API key from Resend for password reset emails. Optional but recommended.
RESEND_FROM_EMAIL
Sender address for emails. Must be from a verified domain in your Resend account.
RESEND_FROM_EMAIL=noreply@yourdomain.com
APP_URL
Public URL of your deployment. Used for password reset links and OAuth callbacks.
APP_URL=https://yourdomain.com
X (Twitter) Integration
X_INTEGRATION_ENABLED
Master switch for X bookmarks import. Default: false.
X_INTEGRATION_ENABLED=true
X_CLIENT_ID / X_CLIENT_SECRET
OAuth 2.0 credentials from the X Developer Portal. Required when X integration is enabled.
- Create a project and app (or use existing)
- Enable OAuth 2.0 under “User authentication settings”
- Set Type to “Web App” (Confidential Client)
- Set Redirect URL to
{APP_URL}/settings?section=connections - Required scopes:
bookmark.read,tweet.read,users.read,offline.access
X_REDIRECT_URI
Override the OAuth callback URL. Defaults to {APP_URL}/settings?section=connections.
X_MAX_BOOKMARK_PAGES / X_MAX_BOOKMARKS
Sync limits per run. Defaults: 10 pages, 300 bookmarks. Set to 0 for unlimited.
Docker-Only Variables
MONGO_ROOT_USERNAME / MONGO_ROOT_PASSWORD
MongoDB root credentials for Docker container initialization. Not needed for managed MongoDB.
MONGO_ROOT_USERNAME=admin
MONGO_ROOT_PASSWORD=your_secure_password_here
Change default password immediately in production.
Redis
REDIS_URL
Redis connection URL for account lockout tracking and ephemeral state.
# Docker
REDIS_URL=redis://redis:6379/0
# Local
REDIS_URL=redis://localhost:6379/0
Other
LOG_LEVEL
Application logging verbosity. Values: debug, info, warning, error. Default: info.
# Development
LOG_LEVEL=debug
# Production
LOG_LEVEL=warning
Environment Profiles
Local Development
MONGO_URL=mongodb://localhost:27017/
DB_NAME=arivu_db
SECRET_KEY=dev-secret-key-not-for-production
CORS_ORIGINS=*
GEMINI_API_KEY=your_key
LOG_LEVEL=debug
Docker Compose
MONGO_URL=mongodb://admin:changeme123@mongodb:27017/
DB_NAME=arivu_db
MONGO_ROOT_USERNAME=admin
MONGO_ROOT_PASSWORD=secure_password
SECRET_KEY=generate_a_real_key
CORS_ORIGINS=http://localhost
GEMINI_API_KEY=your_key
LOG_LEVEL=info
Production
MONGO_URL=mongodb+srv://user:pass@cluster.mongodb.net/
DB_NAME=arivu_production
SECRET_KEY=long_secure_random_hex_key
CORS_ORIGINS=https://yourdomain.com
GEMINI_API_KEY=your_key
RESEND_API_KEY=your_resend_key
RESEND_FROM_EMAIL=noreply@yourdomain.com
APP_URL=https://yourdomain.com
ADMIN_EMAILS=admin@yourdomain.com
LOG_LEVEL=warning
Production Checklist
Before deploying:
- Generated unique
SECRET_KEY(minimum 32 characters) - Changed default
MONGO_ROOT_PASSWORD - Restricted
CORS_ORIGINSto actual domains - Added valid
GEMINI_API_KEY - Set
LOG_LEVELtowarningorerror - All URLs use HTTPS
-
.envis in.gitignore - Secrets stored securely (not in version control)