Environment Variables

Socon-MKT relies on environment variables to securely manage API keys, database credentials, and storage endpoints. These values differ between local development and production environments.

Security Notice

The .env files must never be committed to version control. Ensure .env is declared in the .gitignore file of both repositories before deployment.


Frontend Variables (.env)

The frontend environment configuration is maintained in the root directory of the sokoni-mkt repository. Vite requires all custom environment variables to be prefixed with VITE_.

Below is the structure of the frontend environment variables:

# Local Development URLs
VITE_API_BASE_URL="<local_backend_api_url>"
VITE_API_BASE_DOMAIN="<local_backend_domain>"

# Google Authentication
VITE_GOOGLE_WEB_CLIENT_ID="<google_client_id>.apps.googleusercontent.com"

# Platform API Key
VITE_API_KEY="<frontend_api_key>"

Backend Variables (.env)

The backend environment configuration is maintained in the root directory of the sokoni-mkt-backend repository (Django). These variables control debug mode, security, database connections, and object storage.

Below is the structure of the backend environment variables:

# Core Django Settings
DEBUG=<boolean_value>
SECRET_KEY="<django_secret_key>"
ALLOWED_HOSTS=<comma_separated_allowed_hosts>

# External APIs
RESEND_API_KEY="<resend_api_key>"

# Database Configuration (Development - SQLite)
DATABASE_URL="<sqlite_db_path>"

# Database Configuration (Production - PostgreSQL)
DB_ENGINE="<database_engine_path>"
DB_NAME=<database_name>
DB_USER=<database_user>
DB_PASSWORD="<database_password>"
DB_HOST=<database_host_ip>
DB_PORT=<database_port>

# Cloudflare R2 Settings (Object Storage)
AWS_ACCESS_KEY_ID='<cloudflare_r2_access_key>'
AWS_SECRET_ACCESS_KEY='<cloudflare_r2_secret_key>'
AWS_S3_ENDPOINT_URL='<cloudflare_r2_endpoint_url>'
AWS_STORAGE_BUCKET='<storage_bucket_name>'
AWS_S3_CUSTOM_DOMAIN="<cloudflare_r2_custom_domain>"

Database Switching

The project uses SQLite for local development (DATABASE_URL) and PostgreSQL in production (DB_* variables). Ensure only the relevant block is active depending on the environment, or that your settings logic switches between them based on DEBUG.