LearnHouse is an open source platform that makes it easy for anyone to provide world-class educational content. This is the Community Edition - designed for self-hosting on your own infrastructure.
TLDR: cp .env.example .env and run docker-compose -f docker-compose.yml up -d and inspect the logs, should be ready to go in less than 2 mins
- Docker Engine 20.10+ and Docker Compose 2.0+
- At least 2GB RAM
- 10GB+ disk space
- A domain name (optional, for production; use
localhostfor local development)
- Clone or download LearnHouse Community Edition
git clone https://github.com/learnhouse/community-edition.git
cd community-edition- Configure environment variables
cp env.example .env
# Edit .env with your configuration
vi .envLEARNHOUSE_INITIAL_ADMIN_EMAIL: Email for the first admin user (defaults toadmin@school.dev)LEARNHOUSE_INITIAL_ADMIN_PASSWORD: Password for the first admin user (randomly generated if not set)
- Start LearnHouse
docker-compose -f docker-compose.yml up -d- Access LearnHouse
- Frontend: http://localhost
- Login with Initial Admin Credentials
On first start, use the credentials you configured:
- Email: The value you set for
LEARNHOUSE_INITIAL_ADMIN_EMAIL(oradmin@school.devif not set) - Password: The value you set for
LEARNHOUSE_INITIAL_ADMIN_PASSWORD
LearnHouse uses a multi-container architecture:
- learnhouse-app: Combined Next.js frontend and FastAPI backend application (includes internal nginx on port 80)
- nginx: Reverse proxy (port 80 externally)
- db: PostgreSQL database
- redis: Redis cache
All containers communicate via a Docker network. The learnhouse-app container runs both the frontend and backend services internally, with nginx routing requests between them.
All environment variables are loaded from the .env file automatically. The docker-compose configuration uses env_file to load all variables, so you don't need to specify them inline.
# Email for the first admin user created during installation
# For local development:
LEARNHOUSE_INITIAL_ADMIN_EMAIL=admin@school.dev
# For production:
# LEARNHOUSE_INITIAL_ADMIN_EMAIL=admin@yourdomain.com
# Password for the first admin user (set this before first installation)
LEARNHOUSE_INITIAL_ADMIN_PASSWORD=your-secure-password-hereNote: These are only used during the initial installation when creating the first admin user. If not set:
- Email defaults to
admin@school.dev - Password is the value you set for
LEARNHOUSE_INITIAL_ADMIN_PASSWORD
# For local development:
LEARNHOUSE_DOMAIN=localhost
NEXT_PUBLIC_LEARNHOUSE_DOMAIN=localhost
NEXT_PUBLIC_LEARNHOUSE_TOP_DOMAIN=localhost
# For production:
# LEARNHOUSE_DOMAIN=yourdomain.com
# NEXT_PUBLIC_LEARNHOUSE_DOMAIN=yourdomain.com
# NEXT_PUBLIC_LEARNHOUSE_TOP_DOMAIN=yourdomain.com# For local development:
NEXT_PUBLIC_LEARNHOUSE_API_URL=http://localhost/api/v1/
NEXT_PUBLIC_LEARNHOUSE_BACKEND_URL=http://localhost/
NEXTAUTH_URL=http://localhost
# For production:
# NEXT_PUBLIC_LEARNHOUSE_API_URL=http://yourdomain.com/api/v1/
# NEXT_PUBLIC_LEARNHOUSE_BACKEND_URL=http://yourdomain.com/
# NEXTAUTH_URL=http://yourdomain.com# Generate with: openssl rand -base64 32
NEXTAUTH_SECRET=your-random-secret-here
LEARNHOUSE_AUTH_JWT_SECRET_KEY=your-random-secret-hereLEARNHOUSE_SQL_CONNECTION_STRING=postgresql://learnhouse:your-password@db:5432/learnhouse
POSTGRES_PASSWORD=your-secure-passwordLEARNHOUSE_REDIS_CONNECTION_STRING=redis://redis:6379/learnhouseSee env.example for a complete list of optional configuration options including:
- AI features (OpenAI)
- Email configuration (Resend)
- S3 storage
- And more...
The docker-compose configuration automatically loads all variables from the .env file using env_file. This means:
- All variables defined in
.envare available to containers - No need to specify variables inline in docker-compose.yml
- Easy to manage all configuration in one place
- Follows Docker Compose best practices
Before deploying to production:
- Set
LEARNHOUSE_INITIAL_ADMIN_EMAILto your admin email address - Set
LEARNHOUSE_INITIAL_ADMIN_PASSWORDto a strong password (before first start) - Change all default passwords and secrets
- Set
LEARNHOUSE_DEVELOPMENT_MODE=false - Set
NEXT_PUBLIC_LEARNHOUSE_HTTPS=true - Configure proper domain names
- Set up email service (Resend)
- Configure backups for PostgreSQL data
- Set up monitoring and logging
- Review and configure security settings
- Test the installation
LearnHouse uses Docker volumes for data persistence:
learnhouse_db_data: PostgreSQL database datalearnhouse_redis_data: Redis data
These volumes persist even if containers are recreated. To backup:
# Backup database
docker run --rm -v learnhouse_db_data:/data -v $(pwd):/backup alpine tar czf /backup/db-backup.tar.gz /data
# Backup Redis
docker run --rm -v learnhouse_redis_data:/data -v $(pwd):/backup alpine tar czf /backup/redis-backup.tar.gz /dataTo restore:
# Restore database
docker run --rm -v learnhouse_db_data:/data -v $(pwd):/backup alpine tar xzf /backup/db-backup.tar.gz -C /
# Restore Redis
docker run --rm -v learnhouse_redis_data:/data -v $(pwd):/backup alpine tar xzf /backup/redis-backup.tar.gz -C /- Pull latest changes
git pull origin main- Rebuild and restart
docker-compose -f docker-compose.yml build
docker-compose -f docker-compose.yml up -d# All services
docker-compose -f docker-compose.yml logs -f
# Specific service
docker-compose -f docker-compose.yml logs -f learnhouse-app
docker-compose -f docker-compose.yml logs -f db
docker-compose -f docker-compose.yml logs -f redisdocker-compose -f docker-compose.yml psAll services have health checks configured:
- LearnHouse App:
http://localhost/api/v1/health(checks backend health through internal nginx) - Database: PostgreSQL readiness check
- Redis: Redis ping check
- Check logs:
docker-compose -f docker-compose.yml logs - Verify environment variables in
.env - Ensure ports 80/443 are not in use
- Check Docker resources (RAM, disk space)
- Verify
LEARNHOUSE_SQL_CONNECTION_STRINGmatches database credentials - Check database health:
docker-compose -f docker-compose.yml ps db - Ensure database is healthy before backend starts (depends_on is configured)
- Check the learnhouse-app logs:
docker-compose -f docker-compose.yml logs learnhouse-app - Verify all environment variables are set correctly in
.env - Ensure database and redis are healthy
- Check internal nginx routing:
docker-compose -f docker-compose.yml exec learnhouse-app curl http://localhost/api/v1/health
If port 80 is already in use:
# Edit docker-compose.yml and change:
ports:
- "8080:80" # Use different external portThen update your environment variables accordingly.
- Never commit
.envfile - It contains sensitive information - Use strong passwords - Especially for database and secrets
- Keep Docker updated - Regularly update Docker and images
- Firewall configuration - Only expose necessary ports
- Regular backups - Backup database and volumes regularly
- Monitor logs - Check logs regularly for suspicious activity
For Nginx setup, you can customize extra/nginx.prod.conf before starting:
# Edit nginx configuration
nano extra/nginx.prod.conf
# Restart nginx
docker-compose -f docker-compose.yml restart nginxYou can scale the learnhouse-app service:
docker-compose -f docker-compose.yml up -d --scale learnhouse-app=3Note: You may need to configure a load balancer or update Nginx configuration for proper load distribution.
To use an external database, update LEARNHOUSE_SQL_CONNECTION_STRING:
LEARNHOUSE_SQL_CONNECTION_STRING=postgresql://user:pass@external-db-host:5432/learnhouseAnd remove the db service from docker-compose file.
To use external Redis, update LEARNHOUSE_REDIS_CONNECTION_STRING:
LEARNHOUSE_REDIS_CONNECTION_STRING=redis://external-redis-host:6379/learnhouseAnd remove the redis service from docker-compose file.
- Discord: Join our Discord community π
- GitHub Issues: Report bugs or request features
- Documentation: Full documentation
- LearnHouse University: Learn about LearnHouse using LearnHouse
Thank you for your interest π, here is how you can help:
- Getting Started
- Developers Quick start
- Submit a bug report
- Check good first issues & Help Wanted
- Spread the word and share the project with your friends
LearnHouse is made with π, from the UI to the features it is carefully designed to make students and teachers lives easier and make education software more enjoyable.
Thank you and have fun self-hosting LearnHouse!