Setup Instructions
Create a.env.local file in the apps/lms/ directory of your project:
Never commit
.env.local to version control. It’s already included in .gitignore.Required Variables
These variables are essential for EaseLMS to function:Supabase Configuration
1
Get Supabase credentials
- Go to your Supabase project dashboard
- Navigate to Settings → API
- Copy the Project URL and API keys
2
Add to .env.local
Paste the values into your
.env.local fileApplication URL
Optional Variables
These variables enable additional features:AWS S3 Storage
Required for uploading course videos, images, and resources.While optional for development, AWS S3 is highly recommended for production to handle file uploads and video streaming.
Payment Gateways
Enable course payments through Stripe and Flutterwave.Stripe
1
Get Stripe keys
- Sign up at stripe.com
- Go to Developers → API keys
- Copy both the secret and publishable keys
2
Use test keys for development
Use keys starting with
sk_test_ and pk_test_ for development. Switch to live keys (sk_live_ and pk_live_) for production.Flutterwave
Popular for African markets with multi-currency support.Currency Exchange Rates
Enable automatic currency conversion using exchangerate-api.com.Get a free API key at exchangerate-api.com. The free tier provides 1,500 requests per month.
Email Notifications (SendGrid)
Enable automated email notifications for users and admins.1
Create SendGrid account
Sign up at sendgrid.com - free tier includes 100 emails/day
2
Generate API key
- Go to Settings → API Keys
- Click Create API Key
- Give it full access to Mail Send
- Copy the key (shown only once)
3
Verify sender email
- Go to Settings → Sender Authentication
- Verify your domain or single sender email
- Use the verified email as
SENDGRID_FROM_EMAIL
Email Types Sent
When configured, EaseLMS automatically sends: User Emails:- Welcome email on signup
- Course enrollment confirmation
- Course completion notification
- Certificate ready notification
- Payment confirmation
- Payment failed alert
- New enrollment notification
- New payment notification
- Course completion notification
Environment Variable Reference
Complete Example
Here’s a complete.env.local file with all variables:
Variable Naming Conventions
Public vs Private Variables
NEXT_PUBLIC_*- Safe to expose to the browser, accessible in client-side code- No prefix - Server-side only, never sent to the client
Development vs Production
Development Setup
Production Setup
Deployment Platforms
Different platforms have different ways to set environment variables:Vercel
- Go to your project settings
- Navigate to Environment Variables
- Add each variable with appropriate environment (Production/Preview/Development)
- Redeploy to apply changes
Railway
- Open your project
- Go to Variables tab
- Add each variable
- Changes apply automatically on next deployment
Docker
Use an.env file or pass variables in docker-compose.yml:
Security Best Practices
- Never commit
.env.localor.envfiles to version control - Use different keys for development and production
- Rotate keys regularly, especially after team member changes
- Use secrets management in production (AWS Secrets Manager, etc.)
- Limit key permissions to only what’s needed
- Monitor usage of API keys for unusual activity
Troubleshooting
Variables not loading
- Restart the development server after changing
.env.local - Ensure the file is in the correct location:
apps/lms/.env.local - Check for syntax errors (no spaces around
=)
Public variables undefined in browser
Make sure they start withNEXT_PUBLIC_ and restart the dev server.
AWS/Stripe/SendGrid not working
Verify:- Keys are correct and not expired
- Services are enabled in their respective dashboards
- For Stripe: webhook endpoints are configured
- For SendGrid: sender email is verified