This site runs entirely on Cloudflare. Here is a short tour of the pieces and why each one is there.
The shape of it
| Part | What it does |
|---|---|
| Public site | Astro, rendered on demand on Workers and cached at the edge |
| API | Hono on a Worker; the only code that touches the database and file storage |
| Database | D1 (SQLite) holding posts, projects, tags and settings |
| Files | R2 for images, videos and demo bundles |
| Demos | A separate Worker on its own subdomain, shown in sandboxed iframes |
Content is data
Posts are stored as Markdown in the database and rendered to HTML once, when they are saved. Pages then only need to fetch ready-made HTML, which keeps them fast.
// The public site calls the API over a service binding: no network hop.
const res = await api.entries[':type'][':slug'].$get({
param: { type: 'post', slug },
query: { locale },
});
Two languages from day one
English lives at the root and Chinese under /zh/. Each post has one row per language, and every page shows one language only: a link to a Chinese page that is not translated yet leads to the English page instead.
Demos stay in their sandbox
Demos run on a different origin inside sandboxed iframes, so their code can never reach the main site. Here is one running right now: