Skip to content

Environment Variables Reference

All environment variables used by the SaaS module, with their defaults and descriptions.


Core Configuration

VariableDefaultDescription
TENANT_DATABASE_MODEseparateTenant data isolation strategy: separate (one DB per tenant) or single (shared DB with tenant_id)
TENANT_PROVISIONING_DRIVERsyncHow provisioning jobs run: sync (immediate) or queue (background worker required)

SaaS Settings Defaults

These are used when no value has been saved in the database yet. Once an admin saves settings via the UI, the database value takes precedence.

VariableDefaultDescription
SAAS_ALLOW_MODE_SWITCH_WITH_EXISTING_TENANTSfalseAllow switching DB mode when tenants exist
SAAS_ALLOW_MODULE_UNINSTALLtrueAllow module uninstallation from Module Manager
SAAS_ALLOW_RESOURCE_DELETIONfalseAllow destructive deletion of module data during uninstall
SAAS_ENABLE_ADMIN_ROUTESfalseEnable LMS admin panel on central domain
SAAS_ENABLE_STUDENT_PANEL_ROUTESfalseEnable student panel on central domain
SAAS_ENABLE_TEACHER_PANEL_ROUTESfalseEnable teacher panel on central domain
SAAS_ENABLE_PARENT_PANEL_ROUTESfalseEnable parent panel on central domain

Billing Settings Defaults

VariableDefaultDescription
SAAS_BILLING_ENABLEDtrueMaster billing toggle
SAAS_TRIAL_ENABLEDtrueEnable free trial for paid plans
SAAS_TRIAL_CARD_REQUIREDfalseRequire payment card to start a trial
SAAS_TRIAL_CARD_VERIFICATION_AMOUNT0Amount to authorize when trial requires card (0 = verify only)
SAAS_TRIAL_DAYS14Number of trial days
SAAS_FREE_PLAN_ENABLEDtrueAllow free plan registration
SAAS_AUTO_RENEWAL_ENABLEDtrueEnable automatic subscription renewal
SAAS_AUTO_RENEWAL_REMINDER_DAYS7Days before renewal to send reminder email
SAAS_TRIAL_ENDING_REMINDER_DAYS3Days before trial end to send warning email

Billing Security

VariableDefaultDescription
SAAS_REQUIRE_EMAIL_VERIFICATIONtrueRequire email verification before billing
SAAS_REQUIRE_PAYMENT_VERIFICATIONtrueVerify payments before activating subscriptions
SAAS_ENABLE_AUDIT_LOGGINGtrueLog billing settings changes
SAAS_ENCRYPT_PAYMENT_DATAtrueEncrypt payment data at rest

Registration

VariableDefaultDescription
SAAS_REGISTRATION_TRIAL_DEFAULTtrueDefault to trial option during registration
SAAS_ALLOW_PAY_NOW_OPTIONtrueShow "Pay Now" option during registration
SAAS_MIN_PASSWORD_LENGTH8Minimum password length for tenant registration (range: 6–64)
SAAS_REQUIRE_PASSWORD_CONFIRMATIONtrueShow password confirmation field during registration

Currency & Invoices

VariableDefaultDescription
BILLING_CURRENCYUSDISO currency code for all billing
BILLING_CYCLEmonthlyDefault billing cycle for new subscriptions
INVOICE_PREFIXINVPrefix for invoice numbers

Billing Storage Keys

These control the database and cache key names. You typically don't need to change these unless you have naming conflicts.

VariableDefaultDescription
SAAS_BILLING_SETTINGS_KEYsaas_billing_settingstheme_settings table key for billing settings
SAAS_BILLING_LEGACY_SETTINGS_KEYbilling_settingsLegacy key (read for backward compatibility)
SAAS_BILLING_CACHE_KEYsaas_billing_settingsCache key for billing settings
SAAS_BILLING_LEGACY_CACHE_KEYbilling_settingsLegacy cache key
SAAS_BILLING_PAYMENT_METHODS_CACHE_KEYsaas_billing_settings_payment_methodsCache key for payment methods
SAAS_BILLING_LEGACY_PAYMENT_METHODS_CACHE_KEYbilling_settings_payment_methodsLegacy payment methods cache key

Demo Data Import

VariableDefaultDescription
SAAS_TENANT_DEMO_SQL_FILEtenant-demo.sqlSQL file for separate-DB mode demo import
SAAS_DEFAULT_DEMO_SQL_FILEdemo.sqlFallback SQL file when tenant-specific file is missing
SAAS_TENANT_DEMO_DATA_FILEtenant-demo-data.phpPHP array file for single-DB mode demo import
SAAS_DEFAULT_DEMO_DATA_FILEdemo-data.phpFallback PHP file when tenant-specific file is missing
SAAS_TENANT_DEMO_BLOCKED_EMAILSadmin@gmail.comComma-separated emails to exclude from demo admin import

Payment Gateway Keys

These are not SaaS-specific but are required for payment gateways to function:

VariableDescription
STRIPE_KEYStripe publishable key
STRIPE_SECRETStripe secret key
PAYPAL_CLIENT_IDPayPal client ID
PAYPAL_SECRETPayPal secret
RAZORPAY_KEYRazorpay key ID
RAZORPAY_SECRETRazorpay key secret
PAYSTACK_PUBLIC_KEYPaystack public key
PAYSTACK_SECRET_KEYPaystack secret key

See Payment Gateways for gateway-specific setup instructions.


Example .env Section

env
# === SaaS Core ===
TENANT_DATABASE_MODE=separate
TENANT_PROVISIONING_DRIVER=sync

# === Billing ===
BILLING_CURRENCY=USD
BILLING_CYCLE=monthly
INVOICE_PREFIX=INV
SAAS_BILLING_ENABLED=true
SAAS_TRIAL_ENABLED=true
SAAS_TRIAL_DAYS=14
SAAS_FREE_PLAN_ENABLED=true
SAAS_AUTO_RENEWAL_ENABLED=true

# === Security ===
SAAS_REQUIRE_EMAIL_VERIFICATION=true
SAAS_ENCRYPT_PAYMENT_DATA=true

# === Route Toggles ===
SAAS_ENABLE_ADMIN_ROUTES=false
SAAS_ENABLE_STUDENT_PANEL_ROUTES=false
SAAS_ENABLE_TEACHER_PANEL_ROUTES=false
SAAS_ENABLE_PARENT_PANEL_ROUTES=false