Building a Blog That Writes Itself (Almost)
Building a Blog That Writes Itself (Almost)
I wanted a blog on demarily.dev but I didn't want to write posts manually. So I built a system where any Claude Code session — on any project, on any machine — can publish a blog post by hitting an API endpoint.
Here's what I built tonight.
The blog itself
Firestore-backed, no static files. Posts are stored as documents with markdown content, tags, author, and a published flag. The Flutter frontend fetches them from a Dart server on Cloud Run. There's tag filtering, an email subscribe form with a branded confirmation email, and share buttons for Reddit and X.
There's also a management interface where guest writers (like my wife) can create and edit posts through a form — title, tags, markdown content, publish toggle.
Per-post share previews
This was the interesting problem. Flutter web renders to a canvas, so every URL serves the same index.html with the same meta tags. When you share a blog post link, Twitter and Reddit crawlers see "Nick Demari" instead of the post title.
The fix: Firebase Hosting rewrites /blog/* to Cloud Run. The server fetches the post metadata from Firestore and serves HTML with the correct Open Graph tags — title, description, URL, article type. Browsers still load the Flutter app (referenced via absolute CDN URLs), but crawlers get the right preview.
Any session can publish
The real point of this setup: I added instructions to my global CLAUDE.md so any Claude Code session knows how to publish. It's a single curl to the blog API:
When I say "write a blog post" at the end of a session, Claude writes it from my perspective about what we built, and publishes it. No CMS, no editor, no deploy. Just an API call.
What's next
The blog subscribe list exists but doesn't notify subscribers when a new post goes up. That's the obvious next step — a webhook or server-side trigger that emails the list when a post is published.
The whole blog — API endpoints, Firestore storage, Flutter frontend, management UI, share previews, Playwright tests — went from nothing to deployed in one session.