Adding a New x.asapai.net Subdomain
Paint-by-numbers guide. Three steps, five minutes, no code changes needed.
Prerequisites (already done)
These are one-time setup steps that are already complete for asapai.net:
- DNS wildcard —
*.asapai.netCNAME →cname.vercel-dns.com - Root domain in Supabase —
asapai.netexists inroot_domainstable (ID:5480cf17) - Middleware — Automatically detects any
x.asapai.netand routes to/serve
Step 1: Add Domain in Vercel
Go to: Vercel Dashboard → nowpage-saas project → Settings → Domains
Click "Add" and enter your subdomain:
updates.asapai.net
Vercel will auto-provision an SSL certificate. Wait for the status to show "Valid Configuration" (usually 1-3 minutes).
Why not just use the wildcard?
The *.asapai.net wildcard is configured in Vercel but SSL certificates are provisioned per-domain. Each subdomain needs to be added individually for HTTPS to work. DNS already resolves (wildcard CNAME), but without the SSL cert, browsers refuse the connection.
Step 2: Create Domain Record in Supabase
domains tableGo to: Supabase Dashboard → SQL Editor → Run this query:
INSERT INTO domains (
user_id,
root_domain_id,
subdomain,
full_domain,
is_custom_domain,
status
) VALUES (
(SELECT id FROM auth.users LIMIT 1),
'5480cf17-fb5a-4328-b71a-0b718f8ea801',
'SUBDOMAIN',
'SUBDOMAIN.asapai.net',
false,
'active'
);
Example for updates.asapai.net
Replace both instances of SUBDOMAIN with updates. The root_domain_id is the UUID for asapai.net in the root_domains table — always the same for all asapai.net subdomains.
Step 3: Publish Pages
Use hc-publish.js with --domain set to your new subdomain:
cd /c/users/jason/Downloads/folio-saas
node scripts/hc-publish.js \
--domain updates.asapai.net \
--file "/path/to/your-page.html" \
--slug page-slug \
--folder folder-name \
--tags "tag1,tag2" \
--registry auto \
--update overwrite
Your page is now live at https://updates.asapai.net/page-slug
Quick Reference: All Current Subdomains
| Subdomain | Status | Purpose |
|---|---|---|
ideas.asapai.net | Active | Main content — prospect pages, playbooks, registry |
updates.asapai.net | Active (needs Vercel SSL) | Release notes, changelogs, announcements |
labs.asapai.net | Active | Experimental / lab content |
test.asapai.net | Active | Testing environment |
Adding a Completely New Root Domain
If you need to add a new root domain (not asapai.net — e.g., newbrand.com), there are additional one-time steps:
A. DNS Setup at Registrar
| Type | Name | Value | TTL |
|---|---|---|---|
| A | @ | 76.76.21.21 | 3600 |
| CNAME | * | cname.vercel-dns.com | 3600 |
B. Add Root Domain to Supabase
INSERT INTO root_domains (domain, is_active, default_hosting_type)
VALUES ('newbrand.com', true, 'vercel')
ON CONFLICT (domain) DO NOTHING;
C. Add to Vercel Project
In Vercel Dashboard → nowpage-saas → Settings → Domains, add:
newbrand.com
*.newbrand.com
Then follow Steps 1-3 above for each subdomain you create.
Troubleshooting
SSL Handshake Failed / Connection Refused
The subdomain is not added to the Vercel project. Go to Vercel → Settings → Domains → Add it individually. The wildcard DNS resolves, but Vercel needs to provision an SSL cert per subdomain.
404 Not Found (page loads but shows error)
Domain record missing from domains table in Supabase. Run the INSERT query from Step 2. Make sure status = 'active'.
Page Exists But Returns "No page found"
The page slug doesn't match, or the page's domain_id doesn't match the domain record. Check: SELECT * FROM pages WHERE slug = 'your-slug'; and verify the domain_id matches.
Verify DNS is working
Run in terminal: nslookup yoursubdomain.asapai.net
Should resolve to Vercel IPs (76.76.x.x or 66.33.x.x). If it doesn't, check DNS wildcard CNAME at your registrar.
Architecture Summary
Request flow: Browser → DNS (wildcard CNAME) → Vercel (SSL + routing) → Middleware (extracts subdomain from Host header, rewrites to /serve/[slug]) → Serve Route (looks up domain + page in Supabase) → HTML response
No code changes ever needed
The middleware dynamically fetches root domains from the root_domains table (cached 60 seconds). Adding a new subdomain is purely a config task: Vercel domain + Supabase record. Zero deploys required.