Skip to main content
EaseLMS uses environment variables to configure various services and integrations. This guide provides a complete reference for all available variables.

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

  1. Go to your Supabase project dashboard
  2. Navigate to Settings → API
  3. Copy the Project URL and API keys
2

Add to .env.local

Paste the values into your .env.local file
The SUPABASE_SERVICE_ROLE_KEY has full database access. Never expose it in client-side code or commit it to version control.

Application URL

For production, change this to your actual domain:

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

  1. Sign up at stripe.com
  2. Go to Developers → API keys
  3. 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

  1. Go to Settings → API Keys
  2. Click Create API Key
  3. Give it full access to Mail Send
  4. Copy the key (shown only once)
3

Verify sender email

  1. Go to Settings → Sender Authentication
  2. Verify your domain or single sender email
  3. 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
Admin Emails:
  • 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
Never prefix sensitive keys (like SUPABASE_SERVICE_ROLE_KEY or STRIPE_SECRET_KEY) with NEXT_PUBLIC_ as this would expose them in the browser.

Development vs Production

Development Setup

Production Setup

Deployment Platforms

Different platforms have different ways to set environment variables:

Vercel

  1. Go to your project settings
  2. Navigate to Environment Variables
  3. Add each variable with appropriate environment (Production/Preview/Development)
  4. Redeploy to apply changes

Railway

  1. Open your project
  2. Go to Variables tab
  3. Add each variable
  4. Changes apply automatically on next deployment

Docker

Use an .env file or pass variables in docker-compose.yml:

Security Best Practices

  1. Never commit .env.local or .env files to version control
  2. Use different keys for development and production
  3. Rotate keys regularly, especially after team member changes
  4. Use secrets management in production (AWS Secrets Manager, etc.)
  5. Limit key permissions to only what’s needed
  6. Monitor usage of API keys for unusual activity

Troubleshooting

Variables not loading

  1. Restart the development server after changing .env.local
  2. Ensure the file is in the correct location: apps/lms/.env.local
  3. Check for syntax errors (no spaces around =)

Public variables undefined in browser

Make sure they start with NEXT_PUBLIC_ and restart the dev server.

AWS/Stripe/SendGrid not working

Verify:
  1. Keys are correct and not expired
  2. Services are enabled in their respective dashboards
  3. For Stripe: webhook endpoints are configured
  4. For SendGrid: sender email is verified

Next Steps

After configuring your environment variables:
  1. Set up your database
  2. Deploy to production
  3. Customize your platform