Skip to main content
Environment variables are used to configure sensitive data and environment-specific settings without hardcoding them into your application.

Overview

Dzaleka Online Services uses environment variables for:
  • Email service configuration (Resend API)
  • Deployment adapter selection
  • SSL/TLS certificates (optional)
  • Server configuration

Required Variables

These environment variables are required for full functionality:

RESEND_API_KEY

Required for: Email notifications from Netlify functions Used in:
  • netlify/functions/submit-voice.ts:4
  • netlify/functions/submit-store.ts:4
  • netlify/functions/submit-marketplace.ts:4
  • netlify/functions/submit-course.ts:4
  • netlify/functions/send-feedback-confirmation.ts:4
  • netlify/functions/send-booking-confirmation.ts:4
Description: API key for Resend email service, used to send submission notifications and confirmations. How to obtain:
  1. Sign up for a Resend account at https://resend.com
  2. Navigate to API Keys in your dashboard
  3. Create a new API key
  4. Copy the key (it will only be shown once)
RESEND_API_KEY=re_xxxxxxxxxxxxxxxxxxxxxxxxxxxx

Optional Variables

These variables are optional and provide additional functionality:

NETLIFY

Used in: astro.config.mjs:15 Description: Automatically set by Netlify during deployment. When present, the Netlify adapter is used instead of the Node.js adapter.
NETLIFY=true
You don’t need to set this manually. Netlify automatically provides this variable during builds.

PORT

Used in: dist/server/entry.mjs:1317 Description: Port number for the production server when using Node.js adapter. Defaults to 8080 if not specified.
PORT=8080

HOST

Used in: dist/server/entry.mjs:1321 Description: Host address for the production server when using Node.js adapter.
HOST=0.0.0.0

SERVER_CERT_PATH & SERVER_KEY_PATH

Used in: dist/server/entry.mjs:1261,1264,1265 Description: Paths to SSL/TLS certificate and key files for HTTPS support in standalone Node.js mode.
SERVER_CERT_PATH=/path/to/cert.pem
SERVER_KEY_PATH=/path/to/key.pem
These are only needed for self-hosted deployments with HTTPS. Netlify handles SSL automatically.

ASTRO_NODE_AUTOSTART

Used in: dist/server/entry.mjs:1361 Description: Controls whether the Node.js server starts automatically. Set to disabled to prevent auto-start.
ASTRO_NODE_AUTOSTART=disabled

Example .env File

Create a .env file in the root directory:
.env
# Required
RESEND_API_KEY=re_xxxxxxxxxxxxxxxxxxxxxxxxxxxx

# Optional - Only for self-hosted deployments
# PORT=8080
# HOST=0.0.0.0

# Optional - Only for HTTPS in standalone mode
# SERVER_CERT_PATH=/path/to/cert.pem
# SERVER_KEY_PATH=/path/to/key.pem

Setting Environment Variables in Netlify

For production deployments on Netlify:
2
  • Go to your Netlify dashboard
  • Select your site
  • Click on Site settings
  • 3
    Add Environment Variables
    4
  • Navigate to Environment variables in the sidebar
  • Click Add a variable
  • Enter the variable name and value
  • Select the appropriate scopes (Production, Deploy Previews, Branch deploys)
  • Click Create variable
  • 5
    Add RESEND_API_KEY
    6
    Add your Resend API key:
    7
  • Key: RESEND_API_KEY
  • Value: Your Resend API key (starts with re_)
  • Scopes: Production, Deploy Previews (recommended)
  • 8
    Redeploy
    9
    After adding environment variables, trigger a new deployment:
    10
    git commit --allow-empty -m "Trigger rebuild"
    git push
    
    Changes to environment variables in Netlify don’t automatically trigger a rebuild. You need to manually redeploy.

    Security Best Practices

    Never commit .env files to version control!
    Follow these security practices:
    1. Add .env to .gitignore:
      .gitignore
      .env
      .env.local
      .env.*.local
      
    2. Use .env.example for documentation: Create a template file without sensitive values:
      .env.example
      RESEND_API_KEY=your_resend_api_key_here
      
    3. Rotate keys regularly: Change API keys periodically and after any suspected compromise
    4. Use different keys for development and production: Never use production API keys in development
    5. Limit key permissions: Use API keys with minimum required permissions

    Validation

    The Netlify functions include basic validation. If RESEND_API_KEY is missing, email sending will fail but won’t crash the function:
    try {
      await resend.emails.send({...});
    } catch (emailError) {
      console.error('Error sending email:', emailError);
    }
    
    Check your Netlify function logs to verify emails are being sent successfully.

    Next Steps

    Netlify Deployment

    Learn how to configure environment variables in Netlify

    Configuration

    Explore Astro and Tailwind configuration options

    Build docs developers (and LLMs) love