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
Thenetlify.toml file in your repository root configures the deployment.
Build Settings
netlify.toml
Redirects and Rewrites
The configuration includes important redirects innetlify.toml:14-30:
CORS Headers
API endpoints have CORS headers configured innetlify.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 storiessubmit-store.ts- Submit store listingssubmit-marketplace.ts- Submit marketplace itemssubmit-course.ts- Submit course informationsend-feedback-confirmation.ts- Send feedback confirmationssend-booking-confirmation.ts- Send booking confirmations
netlify/functions/ directory.
Function Configuration
Each function follows this structure:Function URLs
Functions are accessible at: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:- Go to Site settings → Build & deploy → Deploy notifications
- Add notifications for:
- Deploy started
- Deploy succeeded
- Deploy failed
- Choose notification method (Email, Slack, webhook)
Monitoring and Logs
Build Logs
View build logs to debug issues:- Go to Deploys tab
- Click on a deploy
- View the build log output
Function Logs
Monitor serverless function execution:- Go to Functions tab
- Click on a function
- View recent invocations and logs
Analytics
Enable Netlify Analytics for insights:- Go to Analytics tab
- Enable analytics (paid feature)
- View traffic, top pages, and more
Troubleshooting
Build fails
Check Node.js version: EnsureNODE_VERSION = "20" is set in netlify.toml:34.
Clear cache:
Functions not working
Verify environment variables: EnsureRESEND_API_KEY is set in Site settings → Environment variables.
Check function logs:
View function logs in the Netlify dashboard under Functions.
Test locally:
Deployment preview not generating
Check branch deploy settings:- Go to Site settings → Build & deploy → Deploy contexts
- 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