All notes

How I built my portfolio with Claude Code and Astro, and host it for $0 on Cloudflare

Built in a week with Claude Code. What each piece of the stack does, and why none of it costs money.

This site costs me $0 a month to run. Contact form included.

Here’s how it’s built and what it costs. There’s also a bug near the end that had me convinced I was losing it.

The short version

  • Framework: Astro. Every page is static HTML, styled with plain CSS.
  • Hosting: Cloudflare Workers on the free plan. A push to main deploys the site.
  • Contact form: one small Worker function, plus Resend’s free tier for sending email.
  • Code: written with Claude Code, from my own design in Figma.
  • Cost: $0 a month. The domain and my Claude plan are the only things I pay for.

Why I didn’t build it in Framer

I build a lot in Framer, my templates included. It’s fast, and whoever owns the site can edit it without me. For my own site I wanted to write the code. Partly to show I can, partly because I wanted a contact form that does exactly what I want and nothing else.

The stack: Astro, Cloudflare Workers, Resend and Claude Code

Astro builds the site once, at build time, and the browser gets finished HTML. No React, no Tailwind, just CSS with custom properties. There’s a bit of JavaScript for the theme toggle, the dot grid in the hero, the slideshows and the form. That’s it.

Cloudflare Workers hosts it. Static files come straight from Cloudflare’s network, and one small function handles the contact form. The GitHub repo is connected with Workers Builds, so a push to main is a deploy.

Resend sends the emails. When someone sends the form, the function throws out bots (a hidden field only bots fill in), checks the fields, and Resend sends me a plain text email. Reply-to is the person who wrote, so I just hit reply in my normal inbox.

Claude Code wrote most of the code. I designed the site in Figma first, and Claude read the design through the Figma MCP: colors, spacing, text styles. Then we built it one section at a time.

How much it costs to run

Nothing, for a site this size. On the Workers free plan, requests for static files are free and unlimited, and the function gets 100,000 requests a day. My contact form is not getting anywhere near that. Resend’s free plan covers 3,000 emails a month, 100 a day. Same story. Astro is open source.

Two things aren’t free. The domain renews yearly, and Claude Code needs a paid Claude plan. I already pay for that because I use it every day, so this site didn’t add anything to my bills. If you don’t have one, that’s the only real cost here.

How I worked with Claude Code

The most useful thing I did was write a CLAUDE.md file before any code. It’s a page of rules the agent reads before it starts working. A few of them:

- Do not invent or "improve" copy. If text is missing, leave a clearly marked `TODO` and tell me.
- Ask before adding any dependency that is not listed below.
- Plain CSS with custom properties. No Tailwind, no UI kits, no CSS-in-JS.
- Work section by section. After each section: run `npm run build`, fix errors, then stop and show me what changed.

The copy rule mattered most. I wanted the words on this site to sound like me, so nothing went live without my say. We went back and forth on the copy a lot.

“Stop and show me” mattered too. I checked every section in the browser before we moved on. Slower, but nothing piled up that I didn’t understand.

One thing changed after launch. At the start, Figma was the source of truth and the code had to match it. Once the site was live, the code got ahead of the design file, so I flipped it. Now the code is the reference, and new pages like templates are built from components that already exist. There’s no Figma file for them at all.

Why my images didn’t update in Astro dev

I updated the screenshots of two of my templates. Claude took new ones from the live sites, framed them and replaced the files. I opened localhost: old screenshots. Hard refresh: old. Incognito: still old. Claude checked and said the new ones were there. In its browser, they were.

Locally, the Astro Cloudflare adapter runs image requests through Wrangler, and Wrangler caches them on disk by URL. The URL comes from the file name, not from what’s in the file. I’d kept the same names, so the cache kept serving the old images. And only in some sizes: the AVIF versions my Retina screen asks for. Claude’s browser asked for a different size, so on its side everything looked fine.

The fix is to stop the dev server and clear that cache:

rm -rf .wrangler/state/v3/cache

The live site was never affected, because built images get a hash of their content in the file name. It’s a note in CLAUDE.md now, so I won’t lose time on it again.

Would I do it again

Yes. A week from an empty folder to a live site with a working form, and I still understand every file in the repo. Next up is writing here more often. This is the first one.