ProStack uses environment variables for configuration. This guide explains all available variables and their purposes.

Environment Files

ProStack supports multiple environment files:

  • .env: Main environment file for local development
  • .env.docker: Environment variables for Docker deployment
  • .env.production: Production-specific variables (used during build)

Required Environment Variables

These variables are required for the application to function properly:

VariableDescriptionExample
NEXT_PUBLIC_BASE_URLBase URL of your applicationhttp://localhost:3000
DATABASE_URLPostgreSQL connection stringpostgresql://postgres:password@localhost:5432/prostack
BETTER_AUTH_SECRETSecret key for authenticationGenerate with openssl rand -hex 32

Authentication Variables

Variables for configuring the authentication system:

VariableDescriptionRequiredExample
BETTER_AUTH_SECRETAuthentication encryption keyYes1234... (32-byte hex)
GOOGLE_CLIENT_IDGoogle OAuth client IDFor Google auth123456789-abcdefg.apps.googleusercontent.com
GOOGLE_CLIENT_SECRETGoogle OAuth client secretFor Google authGOCSPX-abcdefghijklmnop
RESEND_API_KEYAPI key for Resend email serviceFor email functionalityre_123456789
RESEND_EMAILS_DOMAINDomain for sending emailsFor email functionalitymail.yourdomain.com

AI Chat Variables

Variables for configuring the AI chat feature:

VariableDescriptionRequiredExample
OPENAI_API_KEYOpenAI API keyFor chat functionalitysk-123456789
GOOGLE_SE_API_KEYGoogle Search API keyFor web search toolAIzaSyABC123
GOOGLE_CSE_IDGoogle Custom Search Engine IDFor web search tool123456:abcdef

Storage Variables

Variables for configuring file storage:

VariableDescriptionRequiredExample
BLOB_READ_WRITE_TOKENVercel Blob storage tokenFor file uploadsvercel_blob_rw_123456789

Variables for site verification and social links:

VariableDescriptionRequiredExample
GOOGLE_SITE_VERIFICATION_IDGoogle Search Console verificationNogoogle1234567890
DISCORD_SITE_INVITATION_LINKDiscord community invitation linkNohttps://discord.gg/8yPw7vHj9E

Setting Environment Variables

Local Development

For local development, copy the .env.example file and update the values:

cp .env.example .env

Then update the variables in the .env file with your values.

Docker Deployment

For Docker deployment, use the .env.docker file:

cp .env.docker.example .env.docker

Update the Docker-specific variables like database host.

Production Deployment

For production environments, set environment variables according to your hosting platform:

  • Vercel: Set variables in the Vercel dashboard under “Project Settings > Environment Variables”
  • AWS: Use AWS Parameter Store or Secrets Manager
  • Docker: Use environment variables in your Docker Compose file or Kubernetes secrets
  • PM2: Use environment variables in your PM2 configuration

Securing Environment Variables

Keep your environment variables secure:

  1. Never commit .env files to your repository
  2. Use different values for development and production
  3. Regularly rotate sensitive credentials like API keys
  4. Use secret management tools in production environments

Next Steps