Installation
Install globally via npm:
npm install -g netlify-subdomain
Requirements
- Node.js 14.0.0 or higher
- Netlify CLI (for authentication)
- Domain must be managed by Netlify DNS
First Time Setup
- Make sure you're logged in to Netlify CLI:
netlify login - Verify your domain is in Netlify DNS:
netlify-subdomain list-zones
Quick Start
Add a subdomain to current project
cd your-netlify-project
netlify-subdomain add blog
Add subdomain to specific site
netlify-subdomain add api danielle.world my-api-site
Remove a subdomain
netlify-subdomain remove blog.danielle.world
Commands
add
Add a subdomain to a Netlify site
netlify-subdomain add <subdomain> [domain] [site-name|alias]
Examples:
# Add to current directory's site
netlify-subdomain add blog
# Specify domain and site
netlify-subdomain add api example.com my-api
# Use site alias
netlify-subdomain add shop danielle.world juice
remove
Remove a subdomain
netlify-subdomain remove <full-domain>
list-sites
List all your Netlify sites
netlify-subdomain list-sites
list-zones
List DNS zones managed by Netlify
netlify-subdomain list-zones
list-recent
Show recently added domains
netlify-subdomain list-recent
alias
Create an alias for a site name
netlify-subdomain alias <alias-name> <site-name>
config
View current configuration
netlify-subdomain config
Using Aliases
Aliases let you use short names instead of full Netlify site names:
# Create an alias
netlify-subdomain alias blog my-awesome-blog-123abc
# Use the alias
netlify-subdomain add staging danielle.world blog
Default Aliases
Some aliases are pre-configured:
juice→ juice-box-musicalwedding→ melodic-longma-cade27recipes→ gleeful-profiterole-f78030
Troubleshooting
Common Issues
"Not logged in to Netlify"
Run netlify login to authenticate
"DNS zone not found"
Make sure your domain is managed by Netlify DNS. Check with:
netlify-subdomain list-zones
"No site specified"
Either:
- Run from a Netlify project directory, or
- Specify the site name:
netlify-subdomain add blog domain.com site-name
Domain not working after adding
DNS propagation can take a few minutes. You can check status with:
dig subdomain.yourdomain.com
Changelog
v1.1.1 (2025-06-28)
- Fixed handling of sites without custom domains
- Improved error messages
- Only show success when actually successful
v1.1.0 (2024-12-28)
- Full automation - no manual steps needed
- Remove command now handles domain aliases
v1.0.0 (2024-12-27)
- Initial release