harshalsawant.com
This site. A static Astro build served by a Cloudflare Worker, with Markdown content, no client framework and a visit counter in a SQLite-backed Durable Object.
- Status
- Active
- Area
- Web and services
- Timeline
- Since Nov 2026
- Stack
- Astro, TypeScript, Cloudflare Workers, Durable Objects
This site is static HTML and CSS built by Astro and served from a Cloudflare Worker. One bundled script adds search, the theme switch, writing filters, copy buttons and the visit counter; every page works without it.
How it is built
- Content collections. Posts and projects are Markdown files with schema-checked front matter. A post with a bad date or an unknown tag fails the build.
- No client framework. Pages are
.astrocomponents rendered to HTML at build time. Shiki highlights code blocks in light and dark palettes, and the smoke test fails if any highlighted colour drops below 4.5:1 contrast. - A Worker in front. Cloudflare serves the static files directly and only wakes the Worker for
/api/visits. That endpoint is rate-limited per IP and counts in a SQLite-backed Durable Object. - Strict headers. The Content Security Policy allows scripts only from the site itself, so there is no inline JavaScript anywhere, including the theme script that runs before first paint.
- Written rules.
DESIGN.mdfixes the type, colours and components, andWRITING.mdthe voice. Both live next to the code and change with it. - One command for done.
bun run verifyruns what CI runs: formatting,astro check, a smoke test that boots the Worker locally and crawls every page, and a dry-run deploy.
What's open
- Search downloads the whole index the first time the palette opens. That's small today; past a few hundred entries it should be split or moved into the Worker.