How I built Swapnil’s HQ
From a design mockup to a live research site in one evening, then three names, two editors and a lot of fixes. What I chose, what broke, and what I would change.
Key points
- Built by directing AI. The design started as a mockup I made with Claude, and Claude Code wrote most of the code: 29 of the site’s first 41 commits carry a Claude co-author line. I made the decisions and checked the result.
- Static and plain. Every public page is plain HTML, built before anyone visits. A normal page loads one script file of 5.2 KB (compressed), for page transitions.
- What broke. My first editor, TinaCMS, failed the build when its schema changed, so I replaced it with Keystatic on 9 October 2026. Search returned errors on the live site because its index was built into the wrong folder.
- The real cost. Fonts. Three self-hosted typefaces are 77–85% of what each page downloads.
The first evening
The design came before any code. I made a mockup of the site with Claude and exported it as a single HTML file. It is still in the repository as Company Files (standalone) updated.html, because the site was first called Company Files.
Then I opened Claude Code and built the real site from that mockup on 28 June 2026. The git history shows the evening:
- 4:59 pm First commit. Astro, Tailwind CSS and MDX set up. The mockup’s colours, three typefaces and layout rules turned into design tokens (named values the whole site reads from).
- 7:28 pm Homepage.
- 7:46 pm Archive and the content system.
- 8:12 pm The reading layout for a dossier.
- 9:52 pm TinaCMS added as the writing editor.
- 10:01 pm Production checks: skip link, 404 page, RSS feed, robots.txt.
- 10:55 pm Project created on Vercel.
- 11:04 pm Canonical links, sitemap and RSS pointed at the live address.
About six hours from the first commit to a live site. Fast, but only because I was not typing the code. My job was to decide what the site should do, read what Claude Code produced, and reject what was wrong.
Picking the stack
The first commit’s README set the rule: this is a publication, not a marketing site. A month later a second rule went into the architecture notes: a publication, not a CMS project. Every choice below follows from those two lines. Prefer boring, proven tools. Keep pages static. Let the build catch mistakes before readers do.
| Layer | Choice | Why |
|---|---|---|
| Framework | Astro 5 with MDX | Builds every public page to plain HTML ahead of time. MDX lets one file hold the text and the components (figures, citations, timelines). |
| Content rules | Astro content collections | The build checks every dossier’s fields. A wrong ID or a missing title stops the build instead of going live. |
| Styling | Tailwind CSS v4 | All design tokens live in one CSS file. |
| Editor | Keystatic (since October 2026) | Edits the same files in GitHub. Every save is a commit. No lock file, no cloud index. |
| Hosting | Vercel | Every push to main deploys. Only the editor runs as a server function. |
| Search | Pagefind | The search index is built with the site. No search server. |
| Maths and diagrams | KaTeX and Mermaid | Equations become HTML at build time. Diagram code loads only on pages that have a diagram. |
| Fonts | Space Grotesk, IBM Plex Sans, Space Mono | Self-hosted, so no requests go to Google or any other third party. |
There are 21 production dependencies. React is one of them, but only the editor at /keystatic uses it. Public pages ship no React.
Three names, same addresses
The site has had three names in under four months:
- 28 June: Company Files.
- 29 June: Swapnil’s Research Lab. Dossier ID prefixes changed with it, for example
CFbecameCDfor Company Dossier. - 9 October: Swapnil HQ in the morning, Swapnil’s HQ by the afternoon. It moved from
company-files.vercel.apptohq.swapnilsoren.com, and the GitHub repository was renamed toswapnilhq.
None of the renames changed a dossier’s path. The path comes from the file name, not from the dossier’s ID or the site’s name: ultraviolette.mdx is always /files/ultraviolette. The old name is also kept in the site’s structured data, to help searches for “Swapnil HQ” land here.
The lesson I took: keep a thing’s identity separate from its address. Names change. Links people have shared should not.
The parts worth explaining
Permanent IDs that the build checks
Every dossier has a permanent ID such as CD-001. The prefix must match the dossier type. If it does not, the build fails and nothing is published:
.superRefine((data, ctx) => {
const prefix = FILE_TYPE_PREFIX[data.fileType];
if (!new RegExp(`^${prefix}-\\d{3,}$`).test(data.fileId)) {
ctx.addIssue({
code: z.ZodIssueCode.custom,
path: ["fileId"],
message: `File ID for a ${data.fileType} file must look like ${prefix}-001`,
});
}
}),
npm run new assigns the next ID, makes the file name from the title, dates it in IST and writes a starter draft. I never type an ID by hand.
Drafts I can check, but nobody can find
A draft is built at its real address, so I can read it on my phone or send it to someone for review. It shows a DRAFT banner, tells search engines not to index it, and stays out of the homepage, archive, tags, RSS, search and sitemap.
The sitemap was the tricky part. It is generated outside Astro’s content system, so it cannot ask which pages are drafts. The fix reads each file’s frontmatter directly when the site builds:
const frontmatter = (src) => src.match(/^---\n([\s\S]*?)\n---/)?.[1] ?? "";
return new Set([
...scan("./src/content/files/", ".mdx", (s) => /^status:\s*["']?Draft["']?\s*$/m.test(frontmatter(s)), "/files/"),
...scan("./src/content/builds/", ".md", (s) => /^draft:\s*true\s*$/m.test(frontmatter(s)), "/builds/"),
]);
Citations from a list, not from memory
Sources go in a list at the top of the dossier. In the text I write <Cite n={1} />, and the numbered References section at the end builds itself. Change the order of the list and the numbers follow.
A time field that knows it is in India
Keystatic’s built-in date-and-time field would save 9:00 am IST as 9:00 am UTC, five and a half hours off. The site uses a custom field: I enter IST, and it is stored with a +05:30 offset.
What broke
1. The editor’s lock file. TinaCMS went in on the first evening and was connected to TinaCloud in September. It depended on a generated lock file and a cloud copy of the schema. When those drifted from the code, the build failed. I removed TinaCMS on 9 October 2026 and added Keystatic about half an hour later. Keystatic keeps the schema only in code and writes plain files to GitHub. Suganthan Mohanadasan hit the same problem on his site and made the same move.
2. Search failed on the live site. Pagefind built its index into dist/, but Vercel serves the site from .vercel/output/static. On the live site every search request returned a 404. The fix was one path in the build script.
3. The editor login went to localhost. On Vercel, Keystatic’s GitHub login sent me back to https://localhost. Newer versions of Astro ignore the forwarded host name unless it is on an allow-list. Adding hq.swapnilsoren.com to that list fixed it.
4. Lists with no bullets. A design audit in July found that a Tailwind reset was silently removing the bullets and numbers from every list inside a dossier. The same bug was still hiding on the long build pages. I found it while writing this page and fixed it in the same change.
5. One colon stopped a deploy. On 11 October at 8:20 pm, a colon inside a text field broke the YAML on the tracker page. Vercel marked the build as failed and kept the previous version live. The fix was pushed four minutes later. A static build fails safe: a mistake stops the deploy instead of breaking the site.
What a page actually downloads
I built the site, loaded each page in headless Chrome and added up every file it requested, compressed with gzip. Measured on 18 October 2026:
| Page | Total | Fonts | JavaScript |
|---|---|---|---|
| Homepage | 158 KB | 131 KB | 5.2 KB |
| About | 107 KB | 83 KB | 5.2 KB |
| Ultraviolette dossier | 162 KB | 131 KB | 5.2 KB |
| M&A tracker build page | 191 KB | 162 KB | 5.2 KB |
Without fonts, the homepage is about 27 KB: HTML, two CSS files and one small script. Fonts are 77–85% of every page.
The tracker page loads a fifth font file, 30 KB, because it uses the ₹ sign. That character sits in the “extended Latin” font file, so the first ₹ on a page downloads the whole file.
This is a trade-off I chose. Suganthan’s site uses the fonts already on your device and downloads none. I wanted the site to look the same everywhere, and the table shows the price. A full build, including the search index, takes about 20 seconds on a cloud machine.
How I publish now
- Open
/keystaticon the live site and sign in with GitHub. Or runnpm run newon my laptop. - Write. Components such as Callout, Figure, Cite and Timeline are in the editor’s + menu.
- Leave it as a draft and check it at its real address.
- Change the status to Published and save. The save is a commit to
main, and Vercel deploys it.
The archive, RSS feed, sitemap, tags, reading time, table of contents and related dossiers all update on their own.
What I would do differently
- Pick an editor with no lock file from day one. Moving off TinaCMS was the most avoidable work on this site.
- Write before I design. Most of my early hours went into the site, not the research. A site that looks finished, with short dossiers, sends the wrong message. Now I would publish one full dossier before touching the design again.
- Load fewer font files. The italic body font alone is 49 KB. I would test the device’s own fonts for body text and keep one display face for headings.
Credit
This page follows the structure of Suganthan Mohanadasan’s How I built this site, which covers the same choices on a different stack. If you have questions about any part of this one, ask me on LinkedIn or X.
Built with Claude · Claude Code · Astro 5 · MDX · Tailwind CSS v4 · Keystatic · Vercel · Pagefind