Skip to main content
Deploy your Dzaleka Online Services site to Netlify for fast, reliable hosting with automatic builds and serverless functions.

Why Netlify?

Netlify provides:
  • Automatic deployments from Git
  • Serverless functions for backend logic
  • Global CDN for fast content delivery
  • Automatic HTTPS with free SSL certificates
  • Deploy previews for pull requests
  • Environment variable management

Prerequisites

Before deploying:
  • Git repository with your code (GitHub, GitLab, or Bitbucket)
  • Netlify account (sign up at https://netlify.com)
  • Resend API key for email functionality (get one here)

Deployment Steps

Build Configuration

The netlify.toml file in your repository root configures the deployment.

Build Settings

netlify.toml

Redirects and Rewrites

The configuration includes important redirects in netlify.toml:14-30:

CORS Headers

API endpoints have CORS headers configured in netlify.toml:37-42:

Serverless Functions

Netlify Functions provide backend functionality without a server.

Available Functions

The project includes these serverless functions:
  • submit-voice.ts - Submit community stories
  • submit-store.ts - Submit store listings
  • submit-marketplace.ts - Submit marketplace items
  • submit-course.ts - Submit course information
  • send-feedback-confirmation.ts - Send feedback confirmations
  • send-booking-confirmation.ts - Send booking confirmations
All functions are in netlify/functions/ directory.

Function Configuration

Each function follows this structure:

Function URLs

Functions are accessible at:
Example:

Environment Variables in Production

Manage environment variables after deployment:

Continuous Deployment

Netlify automatically rebuilds your site when you push to your repository.

Automatic Builds

  • Push to main: Deploys to production
  • Push to other branches: Creates branch deploys (if enabled)
  • Open pull request: Creates deploy preview

Deploy Contexts

Configure different settings for different contexts:
netlify.toml

Build Notifications

Enable notifications for build status:
  1. Go to Site settingsBuild & deployDeploy notifications
  2. Add notifications for:
    • Deploy started
    • Deploy succeeded
    • Deploy failed
  3. Choose notification method (Email, Slack, webhook)

Monitoring and Logs

Build Logs

View build logs to debug issues:
  1. Go to Deploys tab
  2. Click on a deploy
  3. View the build log output

Function Logs

Monitor serverless function execution:
  1. Go to Functions tab
  2. Click on a function
  3. View recent invocations and logs
Or use the Netlify CLI:

Analytics

Enable Netlify Analytics for insights:
  1. Go to Analytics tab
  2. Enable analytics (paid feature)
  3. View traffic, top pages, and more

Troubleshooting

Build fails

Check Node.js version: Ensure NODE_VERSION = "20" is set in netlify.toml:34. Clear cache:
Check build logs: Look for error messages in the deploy log.

Functions not working

Verify environment variables: Ensure RESEND_API_KEY is set in Site settings → Environment variables. Check function logs: View function logs in the Netlify dashboard under Functions. Test locally:
This runs functions locally for testing.

Deployment preview not generating

Check branch deploy settings:
  1. Go to Site settingsBuild & deployDeploy contexts
  2. Ensure “Deploy previews” is set to Any pull request against your production branch

Netlify CLI

Install the Netlify CLI for local development:

Useful Commands

Performance Optimization

Build Optimization

Enable build plugins: Add Netlify build plugins for optimization:
netlify.toml

Asset Optimization

Netlify automatically optimizes:
  • Image compression
  • Asset bundling
  • Brotli compression
  • HTTP/2 server push

Next Steps

Custom Domain

Connect a custom domain to your Netlify site

Environment Variables

Learn more about environment variable configuration