← cd .. (back to the actual site)
view source ↗/howdidimakethis/ch-ai

$ whoami
> a visitor who found the trapdoor

$ cat ./README.md | head -2
> ch-ai.in — a portfolio with four skins and an unreasonable amount of care

$ ./reveal --app=ch-ai
> booting write-up...

So, you found the trapdoor.

This is how ch-ai.in — the site you were just looking at — is actually built: the stack, the four-theme engine, the infrastructure, and the pipeline that ships it. No marketing copy, just the real thing.

$ cat stack.txt

stack

Next.js 16 (App Router, built with Turbopack) running on React 19 and TypeScript in strict mode, styled with Tailwind CSS v4. The whole site is a static export — output: "export" in next.config.ts — so there is no server at request time, no API routes, no middleware. Just files.

Next.js 16 (App Router)React 19TypeScript (strict)Tailwind CSS v4CDKTF (Terraform CDK)GitHub Actions (Workload Identity Federation)GCP: Cloud DNS, Firebase Hosting
$ cat architecture.md

architecture

Two flows worth knowing about: what happens when a change gets pushed, and what happens when someone opens the site. Both end up at the same two GCP resources.

yougit push mainGitHub ActionsWIF token exchange —no stored GCP keysa visitoropens ch-ai.inGCP — Cloud DNS + Firebase HostingCloud DNSmanaged zone for ch-ai.inFirebase Hostingsite: ch-ai-portfolio, global CDNCDKTF (Terraform CDK)provisions the two boxes aboveapplied by handno infra CI yet — npx cdktf deployfrom a laptopgcp-static-deploy.yml: build, firebase deployDNS lookup resolves to Firebase Hosting'sanycast IPs, then an HTTPS GET is served from its CDN

Both flows converge on the same Firebase Hosting site — one deploys to it, the other is served from it.

$ cat infra/README.md

infra

Infrastructure is code, not console clicks: CDKTF (Terraform CDK, written in TypeScript) defines a Cloud DNS managed zone for ch-ai.in — carrying the MX/SPF records that keep email forwarding working, plus the A and TXT records Firebase needs to verify and serve the custom domain — and a Firebase Hosting site the static export deploys to.

It's actually two CDKTF stacks, the same split the AWS stack used. A one-time, hand-run infra-gcp-bootstrap stack sets up Workload Identity Federation — a WIF pool and provider GitHub Actions federates into, a deploy service account scoped to exactly this project, and the Cloud Storage bucket the real stack's state lives in. The real stack, infra-gcp, reads and writes its state there.

This site didn't start on GCP. It ran entirely on AWS — S3 + CloudFront + Route53 + ACM — until a billing/support dead end made GCP the faster path forward. Rather than tear the AWS stack down, it's left deployed on purpose: CloudFront, S3, ACM, Lambda, DynamoDB, and IAM are all still there, orphaned, free to run at this traffic level, and ready to cdktf deploy live in an interview if the multi-cloud story is worth telling. Only Route53's hosted zone got deleted — the one AWS resource in this whole stack that actually cost money ($0.50/mo), and the only thing DNS ownership required removing.

$ cat .github/workflows/*.yml

ci / cd

The live deploy path authenticates to GCP the same way the AWS one did to AWS — no long-lived credentials sitting in repo secrets anywhere.

gcp-static-deploy.yml runs on every push to main that touches the app code: install, build the static export, federate into a scoped GCP service account via Workload Identity Federation — no service-account JSON key ever touches this repo — then firebase deploy --only hosting. No approval gate — a content change is low-stakes and reversible.

Cloud DNS and Firebase project changes (infra-gcp) don't have a CI pipeline yet — they're applied by hand, npx cdktf deploy from a laptop. The AWS stack's infra.yml, by contrast, still exists exactly as it did before the migration: a pull request touching infra/** gets a read-only cdktf diff comment, and an actual deploy pauses at a required reviewer. It still works — it's just not wired to anything that affects the live site anymore, since DNS no longer points at CloudFront.

$ cat themes/README.md

the four-theme engine

The site you were on has four completely different skins — magazine, pixel, material, and the one this page's aesthetic is deliberately not — sharing one semantic CSS custom-property contract (--color-surface, --color-ink, --color-accent, and so on). Each theme overrides that contract under its own [data-theme="id"] selector, so shared components like the nav and footer reskin automatically without per-theme component variants.

Light/dark mode is a second, independent layer on top (data-mode), and both the active theme and mode persist to localStorage. A blocking inline script in the root layout applies whatever was stored before the first paint, so switching themes — or just reloading the page — never flashes the wrong one.

$ git log --grep="fix"

field notes

A few bugs that were more interesting than they looked.

the sticky nav that wasn't

overflow-x: hidden on body quietly forces overflow-y into a scrolling value too, per spec — which turned body into its own scroll container and broke the nav's position: sticky (it stuck to body's box, not the viewport). Fixed with overflow-x: clip, which suppresses the same horizontal overflow without creating a new scroll container.

the half-pixel hero

One theme's hero section used a padding shorthand that quietly zeroed out Tailwind's px-6 on the same element — shorthand properties always set all four sides, and the custom class won on specificity. The content sat flush against the screen edge on mobile only. Fixed with longhand padding-top/padding-bottom.

the burger menu that only opened a sliver

The mobile dropdown was position: absolute, meant to anchor to the sticky header. A leftover position: relative on its own wrapper div became the real containing block instead, so it inherited that wrapper's content width — about 48px — rather than the header's. Removed the stray position: relative and it opened full-width, as intended.

the WIF condition that only matched a placeholder

The Workload Identity Federation provider's attributeCondition is supposed to check the deploying repo is this one. It got deployed checking against REPLACE_ME_github_owner/REPLACE_ME_github_repo instead — the real values were meant to come from env vars that were never actually set on the bootstrap run that created it, so the code's placeholder defaults got baked into live infrastructure. Every deploy failed auth with unauthorized_client until that got spotted by reading the deployed Terraform state directly and hardcoding the real repo as the default instead.

$ git log --oneline --reverse

how it got here

v0. One theme — "Ink & Brass" — a single dark, warm palette for the whole site.
v1. The infrastructure went in first: CDKTF, OIDC, the two-workflow CI/CD split — before there was much of a site to deploy.
v2. The four-theme engine: magazine, pixel, material, and monochrome, each with its own type pairing, animation language, and light/dark palette, all sharing one token contract.
v3. A full mobile-responsiveness pass across all four, driven by real device screenshots, then a proper burger menu to replace a nav row that was getting squeezed.
v4. This page — a self-documenting appendix, reachable only if you go looking for it.
v5. Hosting migrated to GCP — Firebase Hosting behind Cloud DNS — after a billing/support dead end on AWS. The original stack stays deployed and orphaned as a live demo; Route53's hosted zone, the one piece of it that actually cost money, is the only part that got deleted.