Internal Service β This is not an HTTP endpoint. Itβs called directly by the
generate-all orchestrator.Purpose
Creates an AWS CloudFront distribution with Lambda@Edge for the domain proxy. This allows the AI site to be served from the customerβs own domain. Runs in GROUP 1f (parallel with scrape, fire-and-forget). Doesnβt need scraped pages.Function Signature
Parameters
| Parameter | Type | Description |
|---|---|---|
url | str | The business website URL |
org_slug | str | The Clerk organization slug |
Returns
What It Creates
- CloudFront Distribution - CDN distribution for the domain
- Lambda@Edge Function - Routes requests between original site and AI site
- SSL Certificate - Via AWS Certificate Manager (ACM)
How The Proxy Works
The Lambda@Edge function intercepts requests and routes:/llms.txt,/robots.txt,/sitemap.xml,/pages/*β AI Site- Everything else β Original website
Database Updates
Updates theai_sites table:
Code Location
Why Pre-create?
The CloudFront distribution is created during onboarding (before the user connects their domain) so that:- DNS propagation can start early
- The distribution is ready when the user completes domain setup
- Reduces wait time in the domain connection flow