Configuration
For self hosted LearnHouse users, a custom configuration file can be used to suit your needs.
Backend config file
Here is an example of the config.yaml
file :
site_name: LearnHouse
site_description: LearnHouse is an open-source platform tailored for learning experiences.
contact_email: hi@learnhouse.app
general:
development_mode: false
install_mode: false
security:
auth_jwt_secret_key: secret
hosting_config:
domain: learnhouse.app
ssl: true
port: 1338
allowed_origins:
- http://localhost:3000
- http://localhost:3001
cookies_config:
domain: ".localhost"
allowed_regexp: '\b((?:https?://)[^\s/$.?#].[^\s]*)\b'
content_delivery:
type: "filesystem" # "filesystem" or "s3api"
s3api:
bucket_name: ""
endpoint_url: ""
mailing_config:
resend_api_key: ""
system_email_adress: ""
database_config:
sql_connection_string: postgresql://learnhouse:learnhouse@localhost:5432/learnhouse
redis_config:
redis_connection_string: redis://localhost:6379/learnhouse
You can also use a .env
file to configure your backend.
If an environment variable is set, it will override the value in the config.yaml
file
LEARNHOUSE_SITE_NAME=LearnHouse
LEARNHOUSE_SITE_DESCRIPTION=LearnHouse is an open-source platform tailored for learning experiences.
LEARNHOUSE_CONTACT_EMAIL=hi@learnhouse.app
LEARNHOUSE_DOMAIN=learnhouse.app
LEARNHOUSE_SSL=true
LEARNHOUSE_USE_DEFAULT_ORG=true
LEARNHOUSE_ALLOWED_ORIGINS=http://localhost:3000,http://localhost:3001
LEARNHOUSE_COOKIE_DOMAIN=.localhost
LEARNHOUSE_ALLOWED_REGEXP=\b((?:https?://)[^\s/$.?#].[^\s]*)\b
LEARNHOUSE_SELF_HOSTED=false
LEARNHOUSE_SQL_CONNECTION_STRING=postgresql://learnhouse:learnhouse@postgresql:5432/learnhouse
General Metadata
Site name
Your site name
Site description
A short description
Contact email
Your designated contact email address.
Hosting Config
Domain
You site's technical domain
SSL
Is SSL used?
Allowed Origins
A list of origins that should be permitted to make cross-origin requests to your website.
Allowed Origins Regex
A regex string to match against origins that should be permitted to make cross-origin requests to your website.
Cookies Domain
Your frontend domain, the domain will be assigned to cookies that the backend emits, authentication and parts of your site would not work if not configured properly.
The value used in the yaml
should be in the "string" format.
Sub Domains
If you want to use the backend for different subdomains locations, for example :
- domain.app
- acme1.domain.app
- acme2.domain.app
You can add a .
before your domain, here it would be .domain.app
Database Config
PostgreSQL Connection string
As of December 2023, we've transitioned our database structure to PostgreSQL.
Your PostgreSQL Database connection string
Redis Config
Redis connection string
Your Redis Database connection string
Mailing Config
Resend API Key
Your Resend API Key
System Email Address
Your System Email Address
Frontend config file
You can also configure your frontend by creating a .env
file in the apps/web
folder.
Authentication (Oauth) configuration
Following the integration of OAuth using NextAuth to manage sign-ups/ins. For this to work, you now need to add two lines to your .env
config file.
To safely encrypt tokens and email hashes, you need a NextAuth secret.
To create one, either run npx auth secret
, or on UNIX based systems (MacOS/Linux) you can use openssl rand -base64 33
.
Copy this string into your .env file as NEXTAUTH_SECRET.
Here is an example of the .env
file :
# Learnhouse configuration
NEXT_PUBLIC_LEARNHOUSE_MULTI_ORG=false
NEXT_PUBLIC_LEARNHOUSE_DEFAULT_ORG=defaultorg
# NextAuth Configuration
NEXTAUTH_SECRET={generated_secret}
NEXTAUTH_URL=http://localhost:3000/
To learn more about Custom Authentication, visit the NextAuth docs here (opens in a new tab).
Multi Organizations
Please check the Multi Organization section for more information.