Skip to content

Environment Variables

Convertella uses different env files for different contexts:

| File | Purpose | | File | Purpose | |---|---|---| | .env | Local development (gitignored). Template at .env.example | | env.production.example | Reference for Cloudflare Pages secrets (production + preview) |

ContextHow vars are set
Local dev (wrangler pages dev)Reads .env file
Production (main branch)Pages Secrets — set via wrangler pages secret put or Cloudflare Dashboard
Branch Previews (feature branches)Inherit Production secrets automatically. Can be overridden per-branch via Dashboard

Production and preview share the same DATABASE_URL by default. To isolate preview DB traffic, use a Neon Logical Branch and set a DATABASE_URL override on the preview branch in the Dashboard.

The two Neon databases are configured separately:

DatabasePages SecretUsed by
TestingDATABASE_URL in all preview branches + local .envFeature branches, local dev
ProductionDATABASE_URL in production environmentmain branch deployments

VariablePurposeRequired
DATABASE_URLNeon connection string (use -pooler URL for serverless). Testing DB in preview branches and local dev, Production DB in production environmentYes

The Pages Production environment has DATABASE_URL set to the production Neon database. All preview branches inherit this value — so you must explicitly override DATABASE_URL to point to the testing database if you want previews isolated from production data.


VariablePurposeRequired
AUTH_SECRETSecret for signing/validating Lucia session cookies (long random string)Yes
OTP_PEPPEROptional HMAC secret for OTP hashing (defaults to AUTH_SECRET if unset, min 16 chars)No
OTP_LOG_DELIVERYIf set, OTP codes are logged to stdout (staging/dev only — do not set in production)Dev/staging
ALLOW_OTP_LOG_DELIVERY_IN_PRODEmergency override to log OTPs even in production (use with extreme caution)No
TURNSTILE_SITE_KEYCloudflare Turnstile site key (OTP abuse protection)Yes
TURNSTILE_SECRET_KEYCloudflare Turnstile secret keyYes

Email delivery uses Cloudflare Email Routing + Email Workers (not Resend).

VariablePurposeRequired
EMAIL_FROMSender address, e.g. Convertella <noreply@convertella.app>Yes
OTP_EMAIL_PROJECT_NAMEOptional project name override in email bodyNo
OTP_EMAIL_SUBJECTOptional subject line overrideNo

Sender domain must be verified in the Cloudflare zone (e.g. convertella.app).


VariablePurposeRequired
WHATSAPP_ACCESS_TOKENMeta Cloud API access tokenIf WhatsApp enabled
WHATSAPP_PHONE_NUMBER_IDWhatsApp sender phone number IDIf WhatsApp enabled
WHATSAPP_OTP_TEMPLATE_NAMEApproved WhatsApp OTP template nameIf WhatsApp enabled
WHATSAPP_OTP_TEMPLATE_LANGTemplate language code (default: en_US)No
WHATSAPP_GRAPH_API_VERSIONMeta Graph API version (default: v21.0)No
WHATSAPP_BUSINESS_ACCOUNT_IDWhatsApp Business Account IDIf WhatsApp enabled
WHATSAPP_APP_SECRETMeta App Secret (webhook verification)If WhatsApp enabled
WHATSAPP_VERIFY_TOKENWebhook verify tokenIf WhatsApp enabled

VariablePurposeRequired
CLOUDFLARE_API_TOKENLeast-privilege API token (include “Custom Hostnames” for for-SaaS)Yes
CLOUDFLARE_ACCOUNT_IDCloudflare account ID (Dashboard → Workers & Pages → Account ID)Yes
CLOUDFLARE_ZONE_IDMain zone ID (DNS, Custom Hostnames, SSL/TLS)Yes
CLOUDFLARE_PAGES_PROJECT_ADMINPages project name for the CRM (default: convertella-admin)Yes

Cloudflare R2 (Document Storage & Backups)

Section titled “Cloudflare R2 (Document Storage & Backups)”
VariablePurposeRequired
R2_ACCOUNT_IDR2 account IDYes
R2_ENDPOINTR2 endpoint URLYes
R2_REGIONRegion (default: auto)No
R2_DOCUMENTS_BUCKETBucket name for documents/imagesYes
R2_DOCUMENTS_ACCESS_KEY_IDR2 access key for documents bucketYes
R2_DOCUMENTS_SECRET_ACCESS_KEYR2 secret key for documents bucketYes
R2_BACKUPS_BUCKETBucket name for database backupsIf backups enabled
R2_BACKUPS_ACCESS_KEY_IDR2 access key for backups bucketIf backups enabled
R2_BACKUPS_SECRET_ACCESS_KEYR2 secret key for backups bucketIf backups enabled

VariablePurposeRequired
OPERATOR_PORTAL_TOKENBearer token for headless API accessYes
OPERATOR_PORTAL_ALLOWED_PROJECT_IDSComma-separated project UUIDs (omit = any project)No

VariablePurposeRequired
CF_ACCESS_TEAM_DOMAINZero Trust team domain (e.g. convertella.cloudflareaccess.com)Yes
CF_ACCESS_AUDAccess audience tagYes
OPERATOR_ALLOWED_EMAILSComma-separated email addresses allowed as operatorsYes

VariablePurposeRequired
DEFAULT_OTP_PROJECT_IDFallback project UUID when Host-based tenant resolution is not active (local dev only)Dev