Skip to Content
Edit on GitHub

Environment Variables

Complete reference of all environment variables used by LearnHouse. These are configured in the .env file generated by learnhouse setup.

Environment variables override any values set in configuration files. The .env file is the recommended configuration method.

General

VariableDescriptionExample
LEARNHOUSE_SITE_NAMEThe name of your LearnHouse instanceLearnHouse
LEARNHOUSE_SITE_DESCRIPTIONA short description of your siteAn open-source learning platform
LEARNHOUSE_CONTACT_EMAILContact email address displayed on the siteadmin@example.com
LEARNHOUSE_SELF_HOSTEDSet to true for self-hosted deploymentstrue
LEARNHOUSE_ENVEnvironment nameproduction
LEARNHOUSE_DEVELOPMENT_MODEEnable development modefalse

Hosting

VariableDescriptionExample
LEARNHOUSE_DOMAINYour site domainlearn.example.com
LEARNHOUSE_SSLEnable SSL (true or false)true
LEARNHOUSE_ALLOWED_ORIGINSComma-separated list of allowed CORS originshttps://learn.example.com
LEARNHOUSE_COOKIE_DOMAINDomain used for cookies (prefix with . for subdomains).example.com
LEARNHOUSE_ALLOWED_REGEXPRegex pattern for additional allowed origins\b((?:https?://)[^\s/$.?#].[^\s]*)\b
LEARNHOUSE_PORTBackend port (default 9000)9000

Database

VariableDescriptionExample
LEARNHOUSE_SQL_CONNECTION_STRINGPostgreSQL connection stringpostgresql://learnhouse:learnhouse@db:5432/learnhouse

Redis

VariableDescriptionExample
LEARNHOUSE_REDIS_CONNECTION_STRINGRedis connection stringredis://redis:6379/learnhouse

Authentication

VariableDescriptionExample
LEARNHOUSE_AUTH_JWT_SECRET_KEYSecret key for JWT token signingGenerate with openssl rand -base64 32

Initial Admin

VariableDescriptionExample
LEARNHOUSE_INITIAL_ADMIN_EMAILEmail for the first admin accountadmin@example.com
LEARNHOUSE_INITIAL_ADMIN_PASSWORDPassword for the first admin accountUse a strong password

Frontend

VariableDescriptionExample
NEXT_PUBLIC_LEARNHOUSE_MULTI_ORGEnable multi-organization modefalse
NEXT_PUBLIC_LEARNHOUSE_DEFAULT_ORGDefault organization slugdefaultorg
NEXT_PUBLIC_LEARNHOUSE_API_URLBackend API URL (used by the frontend)http://localhost/api/v1/
NEXT_PUBLIC_LEARNHOUSE_BACKEND_URLBackend base URLhttp://localhost
NEXT_PUBLIC_LEARNHOUSE_TOP_DOMAINTop-level domain for the frontendlocalhost
NEXT_PUBLIC_LEARNHOUSE_HTTPSWhether the frontend uses HTTPSfalse
NEXT_PUBLIC_LEARNHOUSE_MEDIA_URLURL for serving media contenthttp://localhost/api/v1/
NEXT_PUBLIC_UNSPLASH_ACCESS_KEYUnsplash API key for stock imagesyour-unsplash-key

AI

VariableDescriptionExample
LEARNHOUSE_GEMINI_API_KEYGoogle Gemini API key (primary AI provider)AIza...
LEARNHOUSE_OPENAI_API_KEYOpenAI API key (alternative AI provider)sk-...
LEARNHOUSE_IS_AI_ENABLEDEnable AI features globallytrue

Email

VariableDescriptionExample
LEARNHOUSE_EMAIL_PROVIDEREmail provider: resend or smtpresend
LEARNHOUSE_RESEND_API_KEYResend API key (when using resend provider)re_...
LEARNHOUSE_SYSTEM_EMAIL_ADDRESSSystem email address (sender address)noreply@example.com
LEARNHOUSE_SMTP_HOSTSMTP server hostname (when using smtp provider)smtp.example.com
LEARNHOUSE_SMTP_PORTSMTP server port (default 587)587
LEARNHOUSE_SMTP_USERNAMESMTP usernameuser@example.com
LEARNHOUSE_SMTP_PASSWORDSMTP passwordyour-smtp-password
LEARNHOUSE_SMTP_USE_TLSEnable TLS for SMTPtrue

Content Storage

VariableDescriptionExample
LEARNHOUSE_CONTENT_DELIVERY_TYPEStorage type: filesystem or s3apifilesystem
LEARNHOUSE_S3_API_BUCKET_NAMES3 bucket name (when using s3api)learnhouse-content
LEARNHOUSE_S3_API_ENDPOINT_URLS3 endpoint URL (when using s3api)https://s3.amazonaws.com

Collaboration Server

VariableDescriptionExample
COLLAB_PORTCollaboration server port (default 4000)4000
COLLAB_INTERNAL_KEYInternal key for collaboration service authyour-collab-key
LEARNHOUSE_API_URLAPI URL used by the collaboration serverhttp://learnhouse-app:9000/api/v1
LEARNHOUSE_REDIS_URLRedis URL used by the collaboration serverredis://redis:6379

Payments

VariableDescriptionExample
LEARNHOUSE_STRIPE_SECRET_KEYStripe secret keysk_live_...
LEARNHOUSE_STRIPE_PUBLISHABLE_KEYStripe publishable keypk_live_...

Code Execution

VariableDescriptionExample
LEARNHOUSE_JUDGE0_API_URLJudge0 API URL for code executionhttps://judge0.example.com
LEARNHOUSE_JUDGE0_CLIENT_IDJudge0 client IDyour-client-id
LEARNHOUSE_JUDGE0_CLIENT_SECRETJudge0 client secretyour-client-secret

Analytics

VariableDescriptionExample
LEARNHOUSE_TINYBIRD_API_URLTinybird API URLhttps://api.tinybird.co
LEARNHOUSE_TINYBIRD_INGEST_TOKENTinybird ingest tokenyour-ingest-token
LEARNHOUSE_TINYBIRD_READ_TOKENTinybird read tokenyour-read-token

Observability

VariableDescriptionExample
LEARNHOUSE_SENTRY_DSNSentry DSN for error trackinghttps://abc@sentry.io/123
LEARNHOUSE_LOGFIRE_ENABLEDEnable Logfire loggingfalse

Full Example

.env
# General
LEARNHOUSE_SITE_NAME=LearnHouse
LEARNHOUSE_SITE_DESCRIPTION=An open-source learning platform
LEARNHOUSE_CONTACT_EMAIL=admin@example.com
LEARNHOUSE_SELF_HOSTED=true
LEARNHOUSE_ENV=production

# Hosting
LEARNHOUSE_DOMAIN=learn.example.com
LEARNHOUSE_SSL=true
LEARNHOUSE_ALLOWED_ORIGINS=https://learn.example.com
LEARNHOUSE_COOKIE_DOMAIN=.example.com
LEARNHOUSE_PORT=9000

# Database
LEARNHOUSE_SQL_CONNECTION_STRING=postgresql://learnhouse:learnhouse@db:5432/learnhouse

# Redis
LEARNHOUSE_REDIS_CONNECTION_STRING=redis://redis:6379/learnhouse

# Authentication
LEARNHOUSE_AUTH_JWT_SECRET_KEY=your-generated-jwt-secret
NEXTAUTH_SECRET=your-generated-nextauth-secret
NEXTAUTH_URL=https://learn.example.com/

# Initial Admin
LEARNHOUSE_INITIAL_ADMIN_EMAIL=admin@example.com
LEARNHOUSE_INITIAL_ADMIN_PASSWORD=change-this-password

# Frontend
NEXT_PUBLIC_LEARNHOUSE_MULTI_ORG=false
NEXT_PUBLIC_LEARNHOUSE_DEFAULT_ORG=defaultorg
NEXT_PUBLIC_LEARNHOUSE_API_URL=http://localhost/api/v1/
NEXT_PUBLIC_LEARNHOUSE_BACKEND_URL=http://localhost
NEXT_PUBLIC_LEARNHOUSE_HTTPS=false

# AI (optional)
LEARNHOUSE_GEMINI_API_KEY=
LEARNHOUSE_IS_AI_ENABLED=false

# Email (optional)
LEARNHOUSE_EMAIL_PROVIDER=resend
LEARNHOUSE_RESEND_API_KEY=
LEARNHOUSE_SYSTEM_EMAIL_ADDRESS=

# Content Storage
LEARNHOUSE_CONTENT_DELIVERY_TYPE=filesystem