Automatic Subdomain Allocation
Every project receives a unique subdomain during deployment:The random suffix ensures uniqueness and prevents subdomain conflicts.
Subdomain Binding Model
Each subdomain is tracked in the Binding collection:subdomain- Unique identifier (indexed for fast routing)port- Internal container port (80 for static, custom for Node.js)project- Reference to Project documentcustomDomain- Optional custom domain
Redis Caching for Fast Routing
Subdomain mappings are cached in Redis for microsecond-latency lookups:Updating Subdomains
Users can change their subdomain to a custom value:- 3-40 characters
- Lowercase letters, numbers, hyphens only
- Must be unique across all projects
- No leading/trailing hyphens
Container Recreation Process
When subdomain changes, DeployHub recreates the container:- Stop & Remove old container
- Update Redis cache
- Create new container with updated name
- Start container
Custom Domains
Project Model Schema
SSL Certificate Generation
DeployHub uses Certbot with Cloudflare DNS for SSL certificates:DNS Verification
Custom domains must have DNS A records pointing to DeployHub’s server IP before SSL generation.
Domain Management API
Get Project Domains
Update Subdomain
Networking Architecture
Docker Network
All containers run on theusers Docker network:
Container Naming
Containers are named using their subdomain:Reverse Proxy Routing
The Nginx reverse proxy routes requests based on subdomain:- Request arrives at
my-app-a8c7d2.deployhub.cloud - Redis lookup finds
{ port: "80", projectId: "...", plan: "free" } - Proxy forwards to container
my-app-a8c7d2:80 - Response returned to client
Port Allocation
Static Sites: Port 80 (Nginx)Best Practices
Subdomain Naming
Choose descriptive names that reflect your project:
- ✅
portfolio-john,api-production,blog-staging - ❌
test123,asdf,aaa
Custom Domains
For production deployments:
- Set up DNS A record pointing to server IP
- Wait for DNS propagation (up to 48 hours)
- Request SSL certificate
- Update project with custom domain
Avoid Frequent Changes
Each subdomain change recreates your container:
- Brief downtime during switch
- New container ID
- Stats reset
Limitations
Troubleshooting
”This subdomain is already taken”
Choose a different name - subdomains must be unique across all DeployHub projects.”Invalid subdomain”
Ensure your subdomain:- Uses only lowercase letters, numbers, hyphens
- Is between 3-40 characters
- Doesn’t start or end with a hyphen
Custom domain not working
Check:- DNS A record points to correct IP
- DNS has propagated (use
dig yourdomain.com) - SSL certificate generated successfully
- Domain added to project settings