Environment Variables
Complete reference for all environment variables used by ReliaPulse.
Required Variables
These variables must be set for the application to function.
Database
# PostgreSQL connection string
DATABASE_URL="postgresql://user:password@host:5432/database"Authentication
# NextAuth.js secret (minimum 32 characters)
# Generate: openssl rand -base64 32
NEXTAUTH_SECRET="your-super-secret-key-at-least-32-chars"
# Base URL of your application
NEXTAUTH_URL="https://status.example.com"Redis
# Redis connection for queues and caching
REDIS_URL="redis://localhost:6379"Optional Variables
Email (Resend)
# Resend API key for email notifications
RESEND_API_KEY="re_xxx"
# Default from email address
EMAIL_FROM="noreply@status.example.com"SMS (Twilio)
# Twilio credentials for SMS notifications
TWILIO_ACCOUNT_SID="ACxxx"
TWILIO_AUTH_TOKEN="xxx"
TWILIO_PHONE_NUMBER="+1234567890"Web Push
# VAPID keys for browser push notifications
# Generate: npx web-push generate-vapid-keys
NEXT_PUBLIC_VAPID_PUBLIC_KEY="BPxxx"
VAPID_PRIVATE_KEY="xxx"OAuth Providers
# GitHub OAuth
GITHUB_CLIENT_ID="xxx"
GITHUB_CLIENT_SECRET="xxx"
# Google OAuth
GOOGLE_CLIENT_ID="xxx"
GOOGLE_CLIENT_SECRET="xxx"
# Microsoft/Azure AD OAuth
AZURE_AD_CLIENT_ID="xxx"
AZURE_AD_CLIENT_SECRET="xxx"
AZURE_AD_TENANT_ID="xxx"Encryption
# Key for encrypting sensitive data (2FA secrets, API tokens)
# Generate: openssl rand -base64 32
ENCRYPTION_KEY="your-32-char-encryption-key"Application
# Node environment
NODE_ENV="production"
# Log level (fatal, error, warn, info, debug, trace)
LOG_LEVEL="info"
# Service name for logging
SERVICE_NAME="status-page"
# Worker concurrency
WORKER_CONCURRENCY="10"Feature Flags
# Enable/disable Socket.IO real-time updates
ENABLE_SOCKET_IO="true"
# Enable/disable rate limiting
ENABLE_RATE_LIMITING="true"Environment by Deployment Type
Development
# .env.local
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/statuspage"
REDIS_URL="redis://localhost:6379"
NEXTAUTH_SECRET="development-secret-key-at-least-32-chars"
NEXTAUTH_URL="http://localhost:3000"
NODE_ENV="development"
LOG_LEVEL="debug"Docker Compose
# docker/.env
DATABASE_URL="postgresql://postgres:postgres@db:5432/statuspage"
REDIS_URL="redis://redis:6379"
NEXTAUTH_SECRET="your-production-secret-key"
NEXTAUTH_URL="http://localhost:3000"
POSTGRES_PASSWORD="postgres"Kubernetes
Environment variables should be stored in Kubernetes Secrets:
apiVersion: v1
kind: Secret
metadata:
name: statuspage-secrets
type: Opaque
stringData:
DATABASE_URL: "postgresql://user:pass@postgres:5432/statuspage"
REDIS_URL: "redis://redis:6379"
NEXTAUTH_SECRET: "your-secret"
NEXTAUTH_URL: "https://status.example.com"Vercel
Set variables in the Vercel dashboard under Project Settings → Environment Variables.
Required for Vercel:
DATABASE_URL- Use a hosted PostgreSQL (Neon, Supabase, etc.)NEXTAUTH_SECRETNEXTAUTH_URL
Note: Redis is required for workers. Use Upstash Redis for serverless compatibility.
Security Best Practices
Secret Generation
# Generate secure secrets
openssl rand -base64 32
# Using Node.js
node -e "console.log(require('crypto').randomBytes(32).toString('base64'))"Secret Management
-
Never commit secrets to git
- Use
.env.local(gitignored) - Use secret managers (Vault, AWS Secrets Manager)
- Use
-
Rotate secrets regularly
- NEXTAUTH_SECRET
- API keys
- Database passwords
-
Use different secrets per environment
- Development
- Staging
- Production
Minimum Required for Production
DATABASE_URL # Must use SSL in production
NEXTAUTH_SECRET # Must be unique and secure
NEXTAUTH_URL # Must match your domain
REDIS_URL # Required for background jobs
ENCRYPTION_KEY # Required for 2FA and sensitive dataValidation
The application validates required environment variables at startup. Missing variables will cause the application to fail with a clear error message.
// Environment validation (src/lib/env.ts)
import { z } from "zod";
const envSchema = z.object({
DATABASE_URL: z.string().url(),
NEXTAUTH_SECRET: z.string().min(32),
NEXTAUTH_URL: z.string().url(),
REDIS_URL: z.string().optional(),
});
export const env = envSchema.parse(process.env);Troubleshooting
Variable Not Found
# Check if variable is set
echo $DATABASE_URL
# Check in Docker
docker compose exec app printenv | grep DATABASE_URLConnection String Issues
# PostgreSQL URL format
postgresql://username:password@host:port/database?sslmode=require
# Redis URL format
redis://[[username]:[password]]@host:port[/database]
redis://:password@host:port # Password only
rediss://host:port # With TLSSSL/TLS Connections
For production databases:
# PostgreSQL with SSL
DATABASE_URL="postgresql://user:pass@host:5432/db?sslmode=require"
# Redis with TLS
REDIS_URL="rediss://user:pass@host:6379"