Multi-tenancy lets you run multiple independent ERPNext sites on a single server. Each tenant gets their own database and domain but shares the same codebase. This is essential for hosting ERPNext for multiple clients or departments.
How Multi-Tenancy Works in ERPNext
Frappe Bench supports multi-tenancy natively. Each site is a separate database with its own users, data, and configuration. The Nginx config routes requests to the correct site based on the domain name.
STEP 1 Enable DNS Multi-Tenancy
cd frappe-bench
bench config dns_multitenant onSTEP 2 Create Multiple Sites
# Site for Company A
bench new-site companya.yourdomain.com
bench --site companya.yourdomain.com install-app erpnext
# Site for Company B
bench new-site companyb.yourdomain.com
bench --site companyb.yourdomain.com install-app erpnext
# Site for Company C
bench new-site companyc.yourdomain.com
bench --site companyc.yourdomain.com install-app erpnextSTEP 3 Set Up DNS
Point all subdomains to your server. You can use a wildcard DNS record:
# DNS A Records
companya.yourdomain.com -> your-server-ip
companyb.yourdomain.com -> your-server-ip
companyc.yourdomain.com -> your-server-ip
# Or use a wildcard
*.yourdomain.com -> your-server-ipSTEP 4 Setup Production with Nginx
sudo bench setup production erpnextBench automatically generates Nginx config that routes each domain to the correct site.
STEP 5 Add SSL for Each Site
sudo certbot --nginx -d companya.yourdomain.com
sudo certbot --nginx -d companyb.yourdomain.com
sudo certbot --nginx -d companyc.yourdomain.comManaging Multiple Sites
# Backup all sites
bench --site all backup
# Migrate all sites after update
bench --site all migrate
# List all sites
bench --site all list-apps
# Run command on specific site
bench --site companya.yourdomain.com consoleResource Considerations
# Recommended server specs per number of sites:
1-3 sites: 4 GB RAM, 2 CPU
4-10 sites: 8 GB RAM, 4 CPU
10-25 sites: 16 GB RAM, 8 CPU
# Each site adds approximately:
- 200-500 MB RAM usage
- 1 Redis connection per service
- 1 MariaDB databaseMulti-tenancy is one of ERPNext’s strongest features for service providers. You can host dozens of clients on a single server with complete data isolation between each one.
4 Comments
Join the discussion. Got a question, found an issue, or want to share your experience?
this is test
testing
yes yes
Hello dear