Skip to main content

🔐 Environment Variables

Melify uses environment variables across all services.

Environment Variables

This page documents all environment variables used across different components of the project.

Development Environment

Client Configuration

Configuration for the Next.js client application.

VariableDescriptionRequiredDefault
NODE_ENVSpecifies the environment in which the application is runningYesdevelopment
NEXT_PUBLIC_SERVER_URLThe URL of the backend API serverYeshttp://localhost:8080
NEXT_PUBLIC_ASSET_URLThe URL for serving static assetsYeshttp://localhost:8080
NEXT_PUBLIC_CLIENT_IDGoogle OAuth client ID for authenticationYes-
NEXT_CF_URLCloud Function base URLNo-
NEXT_PUBLIC_USE_TIPTAPFlag to enable/disable Tiptap editorNofalse

API Configuration

Configuration for the backend API service.

VariableDescriptionRequiredDefault
NODE_ENVSpecifies the environment in which the application is runningYesdevelopment
FRONT_URLThe URL of the frontend client applicationYeshttp://localhost:3030
ENVIRONMENT_URLThe API environment's public URLYeshttp://localhost:8080
GOOGLE_CLIENT_IDGoogle OAuth client ID for authenticationYes-
GOOGLE_CLIENT_SECRETGoogle OAuth client secret for authenticationYes-
MONGODB_URIMongoDB connection stringYesmongodb://localhost:27017/melifydevelopment
LAST30DAYSURL for service retrieving last 30 days of email dataYeshttp://localhost:8082/last30days
RETRIEVEEMAILBYLABELSURL for service retrieving emails by labelsYeshttp://localhost:8083/retrieveemailbylabels
TOPICNAMEGoogle Cloud Pub/Sub topic name for Gmail notificationsNoprojects/melify-development/topics/gmail-notifications

GCP Process Mails Service

Configuration for the Google Cloud Platform email processing service.

VariableDescriptionRequiredDefault
SENTRY_SDKSentry SDK key for error trackingYes-

Root Configuration

Global configuration at the project root level.

VariableDescriptionRequiredDefault
DATABASE_NAMEName of the MongoDB databaseYesmelifydevelopment
URI_MONGODBMongoDB connection URIYesmongodb://127.0.0.1:27017
GOOGLE_CLIENT_IDGoogle OAuth client IDYes-
GOOGLE_CLIENT_SECRETGoogle OAuth client secretYes-

Shared Configuration

Environment variables shared across all components.

VariableDescriptionRequiredDefault
OPENAI_API_KEYOpenAI API key for AI servicesYes-
API_KEY_MISTRALMistral AI API key for AI servicesYes-

Notes

  • All variables marked as "Required" must be set for the application to function properly.
  • Variables prefixed with NEXT_PUBLIC_ are exposed to the browser in Next.js applications.
  • Sensitive variables like API keys and secrets should never be committed to version control.
  • For local development, copy .env.example to .env and fill in your values.

Remember to:

  • Keep all secrets and API keys secure
  • Use different values for development, staging, and production environments
  • Rotate secrets regularly
  • Use environment variable management tools in production (e.g., AWS Secrets Manager, HashiCorp Vault)