Building Pages with the Dev Builder
How I write posts for this blog now: a little page builder that only exists on my laptop, and can't publish a thing.

When I moved this blog off Ghost, the thing I was most worried about losing wasn't the hosting or the themes. It was the editor. Ghost's editor is lovely, and "just write some JSON" isn't exactly a compelling replacement.
So the blog has its own page builder. You pick blocks, fill in the forms they generate, and watch the real page take shape next to you. The twist is what it can't do, which I'll get to at the end.
Where it lives
The builder only exists while the site is running locally:
npm run dev
# then open http://localhost:4321/dev/builder/It isn't a normal page in src/pages/. Instead, a tiny Astro integration adds its routes, and only when the command is dev:
const devBuilder = () => ({
name: 'dev-builder',
hooks: {
'astro:config:setup': ({ command, injectRoute }) => {
if (command !== 'dev') return;
injectRoute({ pattern: '/dev/builder', entrypoint: './src/builder/routes/index.astro' });
injectRoute({ pattern: '/dev/builder/posts/[...id].zip', entrypoint: './src/builder/routes/posts/[...id].zip.ts' });
},
},
});That means a production build never contains it. There's nothing at /dev/builder/ on the live site to find, guess or attack.

Page settings
Every post starts with its page settings:
- Title, and the address (
/<slug>/). The address is suggested from the title until you change it yourself. - A summary for search results and link previews.
- A feature image, which doubles as the post's card on the home page.
- The blog details: published date, tags, excerpt, and whether it's featured. A page with these is a blog post (listed on the home page, its tags and the RSS feed). A page without them is just a page, like About Me.
- Draft, which keeps the post out of the live site entirely (no page, listings, RSS, sitemap or search) while still showing it when I run the site locally, with a DRAFT badge.
None of those forms were written by hand. More on that in the post about creating blocks, but the short version is that every field comes from a Zod schema, and the builder reads the schema to decide what to draw: a text box, a Markdown editor, an image picker, a checkbox...
Adding blocks
Below the page settings is the list of blocks that make up the post. There are nine of them right now:
| Block | What it's for |
|---|---|
| Hero | The big header at the top, with its synthwave background |
| Rich text | Most of a post: Markdown, code blocks, tables, diagrams |
| Image | A single image, in the text column, wide or edge to edge |
| Image + text | An image beside a heading and some text |
| Quote | A big pull quote |
| Video | YouTube or Vimeo, only loaded when you press play |
| Card grid | A grid of neon cards, like the timeline on my about page |
| FAQ | Questions that open and close |
| Call to action | A glowing panel with a heading and buttons |
Pick one from the dropdown, press Add block, and it's inserted after the one you've selected, with some starter content so you can see what it looks like. Blocks can be dragged up and down, moved with the arrows, duplicated or deleted, and clicking a block in the preview selects it.

The preview
The right-hand side is the live preview, and it's the bit I'm happiest with. It isn't an approximation of the site, it is the site's components and CSS, rendered inside an iframe. That iframe is the trick: because its width really is the width of a phone, all the site's breakpoints switch exactly as they would on a real device. Flip between Desktop and Mobile at the top.
Images you pick are kept in your browser (as object URLs) so they show up straight away, and ```mermaid diagrams are drawn just like on the real page.

Everything autosaves to your browser as you go: the post itself to localStorage, and any images to IndexedDB (they're far too big for localStorage). Close the tab, come back tomorrow, and your draft is still there.
Opening an existing post
Open… lists every page and post in the repo, straight from the content/ folder of whatever branch I've got checked out. Under the hood, each one is served as a zip (/dev/builder/posts/<slug>.zip, also dev-only), exactly like the builder exports, so opening a post and importing an export are the same code path.

Publishing (well, not quite)
Here's the twist. The builder can't publish anything. It runs entirely in the browser, and the only thing it produces is a zip file to download. When I press Export .zip, it first checks the post against the same schema the build uses, and highlights anything that's wrong (a missing title, an image with nowhere to live, a broken link format). Only a valid post can be exported.
Then, in the terminal:
npm run import-post -- ~/Downloads/building-pages-with-the-dev-builder.zipThe import script checks everything again, makes sure every image the post mentions is actually in the zip, and writes it all to content/<slug>/. On the way, large PNGs and JPEGs are converted to WebP (at most 2000px wide). The images already have sensible, search-friendly names by then, because the builder renames them the moment you pick them: a Midjourney download called mrstebo_a_synthwave_image_showing_a_brain_with_data_flowing_.png becomes brain-with-data-flowing.png.
After that, it's just code. I check it with npm run dev, commit it on a branch, and when I'm ready, merge it. The merge is what deploys it.
So the only way a post reaches the live site is through Git, a build that validates every page, and a deploy. There's no admin login sitting on the internet, because there's no admin at all 😄
Why bother?
Is this more steps than pressing Publish in Ghost? A few, yes. But I get:
- a proper history of every change to every post,
- the ability to work on a post in a branch (this one sat in a branch for a while!),
- a preview that's guaranteed to match the real thing, and
- a live site with nothing to log in to.
That feels like a good trade for a couple of commands.