← cd .. (back to the actual site)
view source ↗/howdidimakethis/resume

$ whoami
> someone who just typed their email into /resume

$ cat ./README.md | head -2
> a gated resume download that counts real interest, not just hits

$ ./reveal --app=resume
> booting write-up...

One PDF. Rather more infrastructure than that implies.

The whole site is static — no server, no database, no API routes. The resume download is the one deliberate exception: a small, real backend that exists for exactly one job. It moved from AWS to GCP along with the rest of the site — see how ch-ai.in itself is built for why.

$ cat decisions.md

why not just a link to a PDF

A static link works fine right up until you want to know whether anyone's actually looking at it. Three decisions shaped this instead:

Instant, on-screen link — not emailed. Emailing the link adds latency, a mail-sending dependency, and a reason for the link to end up in spam. A signed URL handed back immediately is simpler and just as safe, as long as it expires fast.

Firestore for telemetry — not a JSON file in a bucket. A shared JSON file has no atomic read-modify-write: two requests landing close together can race and clobber each other's write. Firestore costs about the same at this traffic level and removes the race entirely — same reasoning DynamoDB served on the AWS version.

Turnstile + a honeypot field — not Cloud Armor. A free, invisible CAPTCHA plus a hidden form field bots fill in but humans never see catches the overwhelming majority of abuse for zero added cost. A WAF is a reasonable next step if that ever stops being true, not a day-one requirement — true on either cloud.

$ cat request-flow.md

request flow

The static site and this one dynamic endpoint are both served through the same Firebase Hosting site — /api/resume/** is a rewrite pointed at a Cloud Function instead of a static file. Same domain, so the browser never has to deal with CORS.

a visitoremail + honeypot +Turnstile tokenGCP — asia-south1Firebase Hosting/api/resume/** rewriteCloud Function (2nd gen)resume-api — public invoker,no shared-secret header hereFirestoretelemetry doc(non-blocking)GCS bucketprivate — resumePDF onlyCDKTF (Terraform CDK)provisions the boxes above,hand-run deploy (no CI yet)CloudflareTurnstilesiteverifyPOST /api/resume/requestsign V4 URL, 600sverify tokenbrowser follows the signed URL straight to GCS — the PDF itself never touches the function

Everything in the request/response cycle is synchronous except the Firestore write, which is fire-and-forget — a logging failure should never be the reason a real visitor doesn't get their resume.

The AWS version had one more layer here worth being honest about: a Lambda Function URL has no equivalent of S3's Origin Access Control, so what actually closed that gap was a shared secret — CloudFront injected an X-Origin-Verify header, and the Lambda rejected anything missing it. Firebase Hosting rewrites don't support injecting a custom header into the proxied request, so there's no equivalent trick available here — this function has to allow unauthenticated invocation for the rewrite to reach it at all, which makes its own Cloud Run URL just as reachable directly. In practice that's a small difference: the honeypot field and Turnstile below are the real gate on either cloud, this is just one fewer (mostly cosmetic) layer on top of them.

$ cat index.ts | grep -A2 verify

the gate, in order

1. Honeypot field — a hidden company input real visitors never see or fill. Anything in it gets a convincing 200 response with no real URL, rather than an error that would teach a bot to leave it blank.
2. Email shape check, then a Turnstile verification against Cloudflare's siteverify endpoint — checked for success, and that the token's action and hostname match this exact integration, per Cloudflare's own defense-in-depth guidance. A network hiccup talking to Cloudflare fails closed (rejects the submission) rather than skipping the check.
3. A soft MX-record lookup on the email domain — stored alongside the telemetry row as a signal, never used to block a real person with an unusual mail setup.
4. A V4 signed GetObject-equivalent GCS URL, good for 600 seconds — long enough to click a button, short enough that a leaked or shared link is worthless within the hour. Signed via the function's own service-account identity through the IAM API, not a private key file.
$ cat infra-gcp/resume-api.ts

infra

The Cloud Function, its Firestore database, the private resume-asset GCS bucket, its dedicated service account, and the IAM bindings that connect them all live in one CDKTF construct (resume-api.ts) inside the same infra-gcp stack that provisions Cloud DNS and the Firebase project — one cdktf deploy, one piece of state, same pattern the AWS version used.

The function's service account is scoped to exactly this bucket and this Firestore database — nothing broader — plus one narrow grant to sign blobs as itself, which is what lets it mint V4 signed URLs without a private key file. Turnstile's secret key is a Terraform variable, supplied at deploy time and never written to a file in this repo. Unlike the static site's content, this stack doesn't deploy from CI yet — it's still a hand-run cdktf deploy, same as the rest of infra-gcp for now.

Cloud Functions 2nd gen (Node.js 20)Firestore — Native modeGCS V4 signed URLsFirebase Hosting rewrite (/api/resume/**)Cloudflare TurnstileCDKTF (Terraform CDK)