Custom Domains
Blitzship was specifically designed to make it as easy as possible to deploy your SaaS to a custom domain. Hence, setting this up is a straightforward process that works almost automatically out of the box. This guide will walk you through the steps to set up your custom domain and explain how it affects various components of your application.
Purchasing a domain
The first step is to purchase a domain. Blitzship requires a domain to be purchased through AWS Route 53, as it integrates seamlessly with the rest of your AWS infrastructure.
- Go to the AWS Route 53 console (opens in a new tab)
- Click on "Registered domains" in the left sidebar
- Click "Register Domain" and follow the steps to purchase your domain
If you already own a domain somewhere else, please migrate it over to AWS Route 53 by following this guide (opens in a new tab).
Setting the DOMAIN
environment variable
Once you have your domain, you need to set it in your environment variables.
- Open your
.env
file for production and the.env.{YOUR_STAGE_NAME}.local
file for local development - Add or update the
DOMAIN
variable with your new domain
DOMAIN=your-domain.com
See the environment variables guide for more information.
Restart the SST Development Server
After setting the DOMAIN
environment variable, you need to restart the SST Development Server.
npx sst dev
This will reconfigure your infrastructure to use your new domain.
Automatic Domain Configuration
Once you've set up your domain and restarted the SST development server, the pre-configured infrastructure in the /infra
folder automatically configures your infrastructure to use your custom domain.
This includes:
- API endpoints
- Landing page
- Documentation website
- Main SaaS application
- Transactional emails
Subdomain structure
Blitzship uses a specific subdomain structure based on your stage name and domain. For example, if your stage name is "maxim" and your domain is "your-domain.com":
API (webhooks)
- Local:
api-maxim.your-domain.com
- Deployed (non-production):
api-maxim.your-domain.com
- Production:
api.your-domain.com
Landing page
- Local:
localhost:3001
- Deployed (non-production):
maxim.your-domain.com
- Production:
your-domain.com
Documentation website
- Local:
localhost:3001/docs
- Deployed (non-production):
maxim.your-domain.com/docs
- Production:
your-domain.com/docs
Main SaaS app
- Local:
localhost:3000
- Deployed (non-production):
app.maxim.your-domain.com
- Production:
app.your-domain.com
- Local:
info@maxim.your-domain.com
- Deployed (non-production):
info@maxim.your-domain.com
- Production:
info@your-domain.com
Your production stage name must be called production
to ensure that these subdomains are correctly configured.
DNS and Email Configuration
Blitzship automatically handles all necessary DNS configurations, including:
- A records for your subdomains
- MX records for email routing
- TXT records for email authentication (SPF, DKIM)
- CNAME records for various services
You don't need to manually configure these records in Route 53 - Blitzship takes care of it all for you.
Sandbox mode for transactional emails
By default, Amazon SES (Simple Email Service) is set to sandbox mode, which restricts email sending. To send emails to any address, you need to request production access:
- Go to the Amazon SES console (opens in a new tab)
- Click on "Request production access" in the dashboard
- Follow the steps to complete the request
Until you get production access, you can only send emails to verified email addresses or domains. This includes the email addresses associated with your custom domain (@your-domain.com in our example).
Summary
With these steps, your SaaS is now fully configured to use your custom domain across all components. The automatic configuration saves you time and ensures consistency across your infrastructure. Remember to always use the appropriate stage name when developing locally to maintain separation between your development and production environments.