Ligang Yan颜力刚

Rebuilding my personal site on Astro and Cloudflare Workers

The first post on the new site, on why I picked this stack and how the site is meant to grow.

metacloudflareastro

中文版:新站上线:用 Astro 和 Cloudflare Workers 重建个人主页

This site has been rebuilt again. Earlier versions were a blog plus a pile of outbound links. The goal hasn’t changed, only the foundation: Astro turns Markdown into pages, Cloudflare Workers runs the site and a small amount of API, and every small tool I’m working on lives on its own subdomain, deployed independently.

Why this stack

  • Writing a post is still just creating a .md file locally and pushing. It’s live a minute later.
  • The site is fully static by default. Only /api/* routes run on the Worker, so there’s a backend only when something needs one.
  • Data goes to D1, KV and R2, all inside the free tier. No server to babysit.

A code block, to test highlighting

import { env } from 'cloudflare:workers';

export async function GET({ params }: { params: { slug: string } }) {
  const n = Number(await env.VIEWS.get(params.slug)) || 0;
  return Response.json({ slug: params.slug, views: n });
}

The visual direction is “editorial”: a paper background, serif headings, monospace metadata. Restrained, not bland.

Older posts will be migrated over time. Chinese versions live under /zh/.