Build Log

Why Astro + Payload + Cloudflare (Building DevToolStack #3)

개발기 시리즈 7편 중 3편. 블록 7개를 쌓는 아이소메트릭 일러스트로, 3번째 블록이 호박색으로 켜져 있다.

I didn't pick these technologies by comparing them one by one. Three requirements from post #1 — it has to show up in search, I need to write, edit, and publish from my own admin, and I need to be able to reshape the screens however I want — filtered out almost every candidate on their own. The comparison table was just there to double-check afterward. This post walks through what decided what, in order.

1. The requirements did the filtering

Since the whole point is ad revenue, no search traffic means none of this matters. So SEO and speed were the top priority from day one.

That one condition set the direction. What a reader needs is finished HTML, not a page assembled in the browser. I decided to go with pre-built static files — easy for search engines to read, fast, and no server required.

Since I also planned to publish in both Korean and English, multilingual routing became part of the requirements too.

Four-panel mockup of the blog homepage — Korean/English × light/dark, four combinations of the same screen
I mocked up the same screen in Korean and English, light and dark, before starting.

1.2 I need to write, edit, and publish from the admin

Admin post editor mockup — content on the left, publish/category panel on the right
The result of deciding that writing, editing, and publishing should all live on my side.

This is exactly why I dropped third-party platforms in post #1. The screen for writing, the screen for editing, and the screen for approving publication all had to be on my side.

A static site alone can't do that. You need a database to hold the posts and a separate admin interface to manage them. That's the point where I decided to split things into two separate pieces: the blog and the admin.

1.3 I need to be able to reshape the screens however I want

This one came from experience. I'd used a Git-based CMS (Decap) before and hit a wall because I couldn't customize the screens. I wanted to bolt on a dashboard and there was no way to do it.

Admin dashboard mockup — four metric cards, an AI-suggested-topics panel, a scheduled-jobs panel, and a recent-posts table
A screen no off-the-shelf CMS has. Whether I could add this was the deciding factor in choosing a CMS.

This time, screens that no off-the-shelf CMS ships with — an analytics dashboard, an AI-review results panel — were part of the plan from the start. I ruled out anything where I'd have to keep asking "does this tool support that?"

2. Filling in the pieces one by one

2.1 The blog — Astro

I had five static site generator candidates: Astro, Next.js, Hugo, Docusaurus, and Eleventy.

Docusaurus has such a strong docs-site template that getting the design I wanted was hard (violates 1.3). Eleventy is lightweight, but I'd have had to build multilingual support and a table of contents myself. Hugo builds the fastest, but bolting on interactive elements was a hassle.

That left Astro and Next.js, and both satisfied the requirements. Here, deployment was the tiebreaker — more on that in 2.3 below.

2.2 The admin — Payload

1.3 basically decided this one.

With Payload, the admin UI itself is my code. Adding a screen isn't "does this CMS support that?" — it's just building one more page. That's also how I was able to rebuild the editor from scratch in post #2.

Strapi and Directus can be self-hosted too, but adding custom screens meant writing plugins. Git-based CMSs don't satisfy 1.2 at all — there's nowhere to put an analytics dashboard or a status-management workflow.

2.3 Deployment — Cloudflare

Deployment came with three conditions:

  • The blog has to stay up 24/7, independent of my MacBook — since the admin was going to run on my home MacBook, readers shouldn't be affected at all if the MacBook is off
  • Cost has to be near zero
  • I need to be able to reach the admin from outside — without opening a port or getting a public IP

Cloudflare solves all three in one place. Static site hosting and CDN are free, and it also gives you a free authenticated tunnel into a server sitting behind your home network (Tunnel), plus authentication in front of it (Access). I'd already bought the domain there too, so there was nothing extra to connect.

And this is also where Astro and Next.js diverged. Deploying Next.js on Cloudflare requires bolting on an adapter, and even then some features don't fully work. Astro's output is just static files — nothing to bolt on. I went with the path with less friction.

3. Where the data lives

3.1 Posts go in a single SQLite file

I couldn't find a reason to use a cloud database. There's one user and one server, so there's never concurrent access from multiple places. Even with thousands of posts, it's all text — a few hundred megabytes at most. Since it's a single file, backing it up just means copying that file.

3.2 Images were supposed to move, but haven't yet

Since images keep piling up and eating disk space, I decided to put them in cloud storage (R2). But I haven't moved them yet. Right now, the build just copies the images folder into the output and ships it along with everything else. It works fine, costs nothing, and moving to R2 would mean registering a payment method.

I did make the eventual move easy, though. The code that resolves image URLs lives in one place, so when I do move them, I only need to change that one spot — none of the posts I've already written need to be touched.

4. The overall picture

flowchart LR
  subgraph mac["Home MacBook (24/7)"]
    admin["Admin<br/>Payload + Next.js"]
    db[("SQLite")]
    ai["AI tasks<br/>via subscription"]
    admin --- db
    ai --- admin
  end
  subgraph cf["Cloudflare"]
    pages["Pages<br/>blog static files"]
    tunnel["Tunnel + Access"]
  end
  admin -->|build and push on publish| pages
  reader(("Reader")) --> pages
  me(("Me, on my phone")) --> tunnel --> admin

The key point is that the blog and the admin are decoupled. Even with the MacBook off, the blog keeps serving readers as normal. The MacBook is only needed for writing posts and pushing deploys.

The tunnel only comes into play when I'm reaching the admin from outside. It's not about moving the server to the cloud — it's about opening up only an authenticated path to it. I'll go into this in detail in post #6.

5. The weak point of this setup

If the MacBook is off, I can't write. Readers aren't affected at all, but I can't do anything either.

I even wrote this risk into the design doc: "If the MacBook is off, that day's scheduled publish won't run."

Looking back, that sentence turned out to be a misplaced worry. At the time I was assuming a setup where drafts got auto-prepared every night — but that whole mechanism ended up getting removed later.

Why I removed it is the subject of the next post.