Building a Photorealistic AI Avatar Infrastructure: Consolidating The Queen's Fleet Hub and Bootstrapping Avatar Generation
What We Built
Over this session, we implemented a complete infrastructure layer to support a photorealistic AI avatar ("Jada") as the public face of The Queen's Fleet, a multi-city entertainment brand. This required four parallel workstreams: (1) domain registration and DNS management, (2) SSL/TLS certificate provisioning, (3) CloudFront hub consolidation across 16 existing city-specific domains, and (4) bootstrapping an AI avatar generation pipeline using fal.ai.
Domain and DNS Infrastructure
We purchased thequeensfleet.com via the Namecheap API, invoked from a Lightsail relay box to avoid credential exposure in CI/CD. The domain registration flow:
- Checked availability and pricing via Namecheap API
- Registered with existing JADA contact information (eliminating the need for separate contact creation)
- Configured as the apex for a new CloudFront distribution (dist ID:
E176JRMB92GPAJ) - Added DNS aliases for three additional city domains:
thepacific,theatlantic,mazatlan
All DNS changes flowed through the Namecheap API using the Lightsail box as a relay—never exposing API credentials to the local development machine. The apex was configured as an ALIAS record pointing to the CloudFront distribution's domain name, enabling HTTP/2 and full caching at the edge.
SSL/TLS Certificate Provisioning
We requested an ACM certificate for thequeensfleet.com in the us-east-1 region (required for CloudFront). The validation flow used CNAME records:
- Fetched the DNS validation CNAME from ACM (name and value)
- Injected it into the Namecheap DNS via API
- Polled ACM until validation completed (typically 5–15 minutes)
- Attached the certificate to the CloudFront distribution
This approach eliminated manual DNS console work and ensured certificate provisioning was idempotent—safe to retry without creating duplicate validation records.
Hub Page Architecture and Deployment
The hub aggregates all 16 destination sites (queenof[city].com domains) into a single marketing entry point. The build pipeline:
- Source:
build/build_hub.pygenerates a static HTML page listing all cities with card images and links - S3 Storage: Deployed to
s3://qos-city-sites/index.html(the root origin for the CloudFront distribution) - Card Images: Each city card references
s3://qos-city-sites/[city-index]/0.jpg, cached at CloudFront - Routing: The CloudFront function (
build/router.js) strips path prefixes and routesGET /toindex.html
Deployment verified ETag headers to catch stale edge caches and invalidated affected CloudFront cache keys after each HTML update.
CloudFront Multi-Origin Routing
The distribution uses two S3 origins:
city-dist: Serves the hub and city card images fromqos-city-sitescity-dist-origin: The existing multi-city origin (kept for backwards compatibility)
The CloudFront function (viewer-request trigger) handles:
- Routing apex requests (
/) to the hub page - Stripping path prefixes for city-specific requests (e.g.,
/thepacific/assets/0.jpg→ S3/thepacific/0.jpg) - Normalizing
wwwsubdomain requests to the same cache key
Function updates were published to CloudFront live, then verified by probing the distribution's HTTPS endpoint before updating DNS.
Avatar Generation Pipeline
We bootstrapped fal.ai integration for photorealistic AI avatar generation. The stack:
- Sprint Factory:
factory/seed_sprint.pygenerates 200 candidate faces with fal.ai image generation API - Model Customization: LoRA (Low-Rank Adaptation) training fine-tunes a Flux diffusion model for consistent avatar features
- API Integration: FAL client library authenticated via API key stored in
~/jada-secrets/fal.api_key - Cost Model: ~$5 for the 200-face sprint, ~$2–8 for LoRA training, remainder for episode stills and video generation
The seed_sprint.py factory prompts fal.ai with consistent styling parameters (age range 18–27, diverse ethnicity, photorealistic quality) and collects results into a candidate grid for manual curation.
Key Infrastructure Decisions
- Lightsail Relay for API Calls: API credentials stay off the local machine; Lightsail box acts as the API gateway for domain and DNS operations.
- CloudFront Function vs. Lambda@Edge: Chose viewer-request-triggered CloudFront function (JavaScript) over Lambda@Edge (Node.js) for lower latency and simpler maintenance. Function is versioned in
build/router.jsand deployed via AWS CLI. - Static Hub Page: No backend—pure S3 + CloudFront. Regenerate and invalidate cache on content changes, avoiding operational complexity.
- CNAME-Based Certificate Validation: Automated via API rather than DNS console to enable reproducible, scriptable infrastructure.
- fal.ai for Avatar Generation: Chose fal.ai over Replicate or RunwayML for Flux diffusion support, lower per-image cost (~$0.01–0.03), and built-in LoRA training workflow. API calls orchestrated from a local factory script with retry logic.
Testing and Verification
After each change, we verified:
- DNS propagation: Queried authoritative nameservers for thequeensfleet.com
- HTTPS availability: Probed CloudFront apex and all city aliases over HTTPS
- Card image loading: Confirmed S3 object paths and CloudFront cache hits
- Router function correctness: Tested path rewriting (e.g.,
/thepacific/0.jpgserved from S3 with correct origin) - Hub page rendering: Checked all 16 city links and image references
Test suite in tests/test_hub.py validates builder output and router logic before deployment.
What's Next
The infrastructure is ready; the avatar generation pipeline awaits fal.ai account funding (~$30–50) to fire the 200-face sprint. Once candidates are approved, the roadmap includes:
- LoRA fine-tuning to lock Jada's identity across generated scenes and time periods
- Integration with the destination sites: hero images, promotional content, social previews
- Video generation for destination teasers and booking experiences
- A/B testing avatar styling and age perception with real traffic
All infrastructure—domains, certificates, routing, S3 origins, CloudFront configs—is now in place to serve Jada as the unified face across all 16 Queen's Fleet destinations.