@rishi23root

How rishi23root.in is put together

rishi23root.in and my GitHub profile README are built from one content folder; this is how the writing, diagrams, mood images, projects, RSS and SEO fit together.

I keep one folder of content in the repo, and two builds read it: one writes my GitHub profile README, the other builds this site. Everything else here (the writing pipeline, the diagrams, the small touches on the home page) is built so that folder stays the only place I edit.

TL;DR

What problem I had

My GitHub profile README has been generated by a script since 2023: a markdown template, a TypeScript config with my bio and featured repos, and a build that fills in stats from the GitHub API. That was fine while the README was the only place I described myself.

Then I wanted a real website with writing on it, and every fact suddenly had two homes. The bio, the mottos, the featured projects and the contact links would live in the README’s config and again somewhere in the site. Every new post would need a title, date and link added to the README by hand. Two copies of the same words drift; it’s only a question of how fast.

I also wanted more than a plain blog: diagrams I could still edit after publishing, a home page with some personality, and pages that stay light on a phone. Most ways of getting those extras quietly put a framework on every page.

What I tried

  1. Keeping the README’s config as the source. The site could import config.ts directly. But then the site depends on the README build’s code, and the data stays locked in a TypeScript file only one build understands.
  2. Making the site the source. Generate the README from the built site. That turns a thirty-line template into a scraper, and the README build would need the whole site build to run first.
  3. Moving the data into plain files both builds read. Bio, mottos, links and featured repos went into content/site.json, and posts into content/posts/*.mdx. config.ts became a few re-exports. Each build loads those files and ignores what it doesn’t need.

For diagrams I weighed exported images first, then embedded a live Excalidraw canvas, and finally settled on an SVG rendered from the scene file.

What worked

The shared folder. Each surface owns its layout, and neither owns the words.

The README build

readme.template.md is about thirty lines: a fenced whoami block and a handful of HTML comment markers like <!-- recent_posts_inject -->. index.ts loads content/site.json (through a thin config.ts), fetches stats, featured repos and recent stars from the GitHub API, renders each block, and swaps it in for its marker.

The posts list doesn’t need Astro. posts.ts reads the MDX files directly, pulls title, date, slug, summary and draft out of the frontmatter, skips drafts, and writes links to /writing/<slug> on this site. A GitHub Action runs the build on every push to master and commits README.md only if it changed.

The writing pipeline

On the site, posts are an Astro content collection loaded straight from ../content/posts. The schema is where I put the rules I kept breaking by hand:

  • title is at most 90 characters and summary at most 220, because the summary is reused as the meta description, the social card text, the RSS line and the llms.txt entry.
  • slug must be kebab-case and must equal the file name. A small check fails the build otherwise, so a renamed file can’t quietly change a URL.
  • draft: true shows the post in npm run dev:web and hides it everywhere else.

Every post follows the same section order: TL;DR, the problem, what I tried, what worked, what failed, architecture, code, results, and what I’d recommend. You’re reading one. The order forces me to write down the failures, which is usually the part worth reading. A private draft template in the repo has the skeleton, and the post page builds its “On this page” rail, reading time and FAQ from the headings and frontmatter.

Diagrams as SVG

A diagram is an Excalidraw scene saved as JSON under web/diagrams/, and in a post it’s one line with no import:

<ExcalidrawBoard src="/diagrams/board-pipeline.json" />

That line renders this:

The site bakes every scene to SVG before the pages render, and the board inlines that file. The browser never downloads Excalidraw. Hover the board and a small control bar shows up for zoom, reset and expand. Drag pans; the scroll wheel stays with the page.

Dark mode is one CSS filter on the SVG, the same invert-and-rotate Excalidraw uses for its own dark theme, so I draw every scene in light mode with dark strokes. The hand-drawn fonts are hosted here, so a board never reaches out to a CDN.

Small things that make it feel like mine

Mood images. On desktop, the home page shows one still image next to the text, and it changes every visit. It’s the most personal part of the site and the one with the most moving parts, so it gets its own section under Architecture.

Command palette. Press ⌘K, Ctrl+K or ? anywhere for a palette of pages, projects and posts, plus “Toggle theme”. There’s no button for it. A 1.1 KB listener ships on every page; the palette itself is 3.7 KB of plain TypeScript, fetched on first open. Two-key chords (G then W for Writing) work without loading it at all.

Themes. Pages ship dark. A tiny inline script in <head> applies a saved light choice before the first paint, so there’s no flash of the wrong theme. The toggle writes to localStorage, and everything that has colour, including the diagrams, follows the data-theme attribute on <html>.

GitHub cards. When a post talks about a repository or a pull request, I can drop in a card instead of a bare link:

<RepoCard owner="rishi23root" repo="rishi23root" />
<PrCard owner="rishi23root" repo="rishi23root" number={21} />
Repository · rishi23root

rishi23root

TypeScript

Pull request · rishi23root/rishi23rootMerged

#21 feat(web): SVG Excalidraw boards, how-this-site-works post, GitHub cards

Read-only Excalidraw boards in Writing posts. Each board is a React island that loads a scene JSON stored in this repo and renders it to a static SVG. There is no object store and…

+6,770 −25241 files27 commitsrishi23rootNov 14, 2026

Both are filled in from the GitHub API when the site builds, so your browser never talks to GitHub, and the stars or the PR’s state are as fresh as the last deploy. If the API is down or rate-limited, the card falls back to a plain labelled link and the build carries on.

Plain links get a lighter version. Hover a link to this site’s repository or to the pull request that added the diagrams and these cards, and a small preview opens under it. The post page scans its own source for GitHub links at build time and renders a preview for each into the HTML. A short script shows the right one on hover or keyboard focus. On a phone, a tap just follows the link.

Feeds and search. RSS, the sitemap, structured data and llms.txt are all generated from the same posts and site.json, so there’s nothing hand-kept to go stale. The details are under Architecture.

What failed

The live Excalidraw canvas. My first version embedded the real Excalidraw app in view mode. Every board flashed an empty white canvas before the drawing appeared. The editor’s stylesheet, about 145 KB, landed in the CSS shared by every post, with or without a board. I spent more CSS hiding Excalidraw’s menus than styling the board. Swapping to SVG fixed all three.

A CSS import that only worked sometimes. Excalidraw exports its stylesheet under development and production conditions, with no default. A plain import '@excalidraw/excalidraw/index.css' built fine and then failed in local dev with “Cannot find module”. A Vite alias fixed it for me and not for everyone else. The real fix was not importing the package statically at all: the component loads it with a dynamic import() in the browser, so the server never tries to resolve it.

Letting the export inline its fonts. By default exportToSvg embeds the hand-drawn font inside the SVG. That means a 1.8 MB font-subsetting script, a worker that failed and fell back to the main thread, and a font fetched from a CDN. Turning that off and hosting the two fonts myself (about 140 KB, split by character range so a page fetches only what it uses) removed all of it.

Trusting the first error message. After a dependency change, the dev server threw jsxDEV is not a function and the boards stayed blank. It looked like a broken component. It was a stale Vite pre-bundle cache. rm -rf web/node_modules/.vite and a restart fixed it. When a dev-only error makes no sense, clear the cache before reading the stack trace.

Two lists for the same six repos. The Projects page reads projects from site.json. The README’s Featured Work and the llms.txt summary read opensource.active and opensource.blurbs. Those are the same six repositories, typed twice, and one blurb has already drifted. That’s exactly the problem this whole setup exists to prevent, sitting in the middle of it. Merging them into one list is on my short list.

Architecture

In words: content/ holds the data. The README build reads the bio and post titles and writes README.md, which GitHub shows on my profile. The Astro site reads everything and deploys to GitHub Pages. Two workflows, both triggered by pushing to master: one only rewrites the README, the other only deploys the site, and the deploy runs only when web/ or content/ changed.

PieceReadsWrites
README build
index.ts, posts.ts
site.json, post frontmatter, GitHub APIREADME.md
Astro site
web/
site.json, full posts, board scenespages, RSS, sitemap, llms.txt
Diagram bake
bake-diagrams.mjs
scene JSON in web/diagrams/SVG inlined into the post

What’s in site.json

This is the whole data side of the site, trimmed to one item per list. The comments say what reads each block:

{
  // Base for every absolute URL: canonical, OG, RSS, sitemap
  "siteUrl": "https://rishi23root.in",
  // README username, nav wordmark, title suffix, RSS title
  "github": { "name": "rishi23root" },

  // README whoami; site meta description, RSS, llms.txt, JSON-LD
  "shortBio": "software engineer · AI · SaaS · automation",
  "fullDescription": "I build useful things at the intersection of…",
  // Site only: the first-person intro on the home page
  "voiceBio": "I’m Rishabh, a software engineer building useful things…",
  // README `$ echo $STACK` and mottos row; llms.txt
  "stackLine": "TypeScript · Python · Node.js · React · React Native",
  "mottos": ["timshel", "fac quod debes"],

  // README contact links; site footer icons, sameAs, llms.txt
  "contact": {
    "email": "[email protected]",
    "socials": {
      "github": "https://github.com/rishi23root",
      "x": "https://x.com/rishi23root"
    }
  },

  // README Featured Work (live stars); llms.txt featured line
  "opensource": {
    "active": ["rishi23root/pyblink"],
    "blurbs": {
      "rishi23root/pyblink": "Blink-counter automation to ease eye strain"
    }
  },
  // README: how many recently starred repos to list
  "recentLikedCount": 8,

  // Site only: home mood plate, /mood gallery, head preload
  "moods": [
    {
      "id": "cyclist",
      "label": "cycling",
      "src": "/mood/cyclist.webp",
      "alt": "Cyclist in green hills under drifting clouds"
    }
  ],
  // Site only: /projects and the command palette, by `order`
  "projects": [
    {
      "title": "pyblink",
      "blurb": "Blink-counter automation to ease eye strain",
      "url": "https://github.com/rishi23root/pyblink",
      "order": 4
    }
  ],
  // Site only: the short "what I do" list on the home page
  "capabilities": [
    { "heading": "Automation & systems", "body": "Python tooling, browser…" }
  ]
}

The real file is plain JSON with no comments. The README build only knows the first half. It reads through config.ts, which re-exports the keys it needs and ignores voiceBio, moods, projects and capabilities, so adding something for the site can’t change the README’s shape. The site imports the file directly through site.ts. You can also spot the duplication from What failed here: opensource and projects describe the same repositories.

Mood images

The catalogue is a list in site.json. Each entry has an id, a short activity label, the image path and alt text:

{ "id": "shore", "label": "sitting", "src": "/mood/shore.webp", "alt": "Figure sitting on a beach shore under open sky" }

There are seven right now: cycling, wandering, roaming, exploring, tennis, sitting and sketching. Each is a portrait WebP between 15 and 170 KB in web/public/mood/. Adding one is an image and four lines of JSON.

On the home page they sit in a plate beside the text, and the caption has two controls: “next” and a link to every mood. Three decisions keep that cheap:

  1. Desktop only. The plate is hidden below 1024px, and the React island that runs it hydrates with client:media="(min-width: 1024px)". A phone gets the text and never downloads React or a single mood image.
  2. A shuffle bag, not random. The order lives in localStorage. Every mood shows once before any repeats, a new round never opens with the image you just saw, and if I add or remove a mood the bag notices and starts over. Each full page load advances it by one, and “next” advances the same bag with a 420 ms crossfade.
  3. Pick before React. The island would normally choose the mood after it hydrates, which means the image request starts late. Instead, an inline script in <head> runs the same shuffle-bag code, picks the mood, and adds a high-priority <link rel="preload"> for that one image. React then adopts that pick instead of advancing again. Once the page has loaded and gone idle, the island quietly prefetches the next mood at low priority, so “next” is instant.

/mood shows the whole catalogue as a grid with each activity label, and every still links to /?mood=<id>, which forces that mood on the home page. The page is noindex and left out of the sitemap; it’s a gallery, not something to rank.

The Projects page is a plain list from site.json: a title, a one-line blurb, a link, and an order field to sort by. It’s static HTML with no client code, and the command palette lists the same projects. Two of the six are upstream projects I contribute to; the rest are mine.

The README’s Featured Work is built from repository names (owner/repo) instead. The build asks the GitHub API for each one, so the star counts are live on every rebuild, and uses my blurb if I wrote one or the repo’s own description if I didn’t. The same names and blurbs feed the “Featured work” line in llms.txt.

RSS

/rss.xml is a short endpoint. It takes the published posts, newest first, and maps each to a title, the post’s summary as the description, the publish date and its link. Because it calls the same getPublishedPosts() as the home page, a draft can’t appear in the feed by accident. Every page advertises it with <link rel="alternate" type="application/rss+xml">, so feed readers find it from any URL.

SEO and answer engines

Classic SEO and answer-engine optimisation (AEO: being quotable by assistants and AI search) turn out to want the same thing here: one clear answer, stated once, in a place a machine can find.

  • Canonical URLs. Every page sets an absolute canonical with a trailing slash, matching how the site is built, so there’s one address per page.
  • Social cards. Open Graph and Twitter tags on every page, with the large-image card. A post uses its image, then its cover, then the site default, always as an absolute URL. Posts set og:type to article and add the publish time.
  • Structured data. The home page describes me as a Person, with my social profiles as sameAs. Each post adds BlogPosting (headline, dates, keywords, image, author), a BreadcrumbList (Home, Writing, post), and FAQPage when the frontmatter has an FAQ. The FAQ is also rendered on the page, so the markup never claims something a reader can’t see.
  • Sitemap and robots. @astrojs/sitemap generates the sitemap at build time and skips /mood and the /blog redirects. robots.txt allows everything, names the main AI crawlers explicitly, and points to the sitemap.
  • llms.txt. A plain-text summary for assistants, generated by an endpoint rather than kept in public/: who I am, my stack and links, featured work, key pages, and every published post with its date and one-sentence summary. It ends with a short note asking assistants to cite this site and not to invent bio claims.
  • Old links. The writing section used to live at /blog. /blog redirects to /writing/, and a small page generates a redirect for every /blog/<slug>. Retired posts get the same treatment; this article replaced an older one, and its URL now points here.

The AEO part is mostly the writing, not the markup. Every post opens with an answer, the summary field is one sentence that still makes sense quoted alone, and FAQ answers are written to stand alone. The markup just makes that easy to find.

Code

The README side is plain string work. This is the whole posts block:

export async function renderRecentPosts(siteUrl: string, limit = 5): Promise<string> {
  const posts = (await listPosts()).slice(0, limit)
  if (!posts.length) return '_No posts yet._'
  const base = siteUrl.replace(/\/$/, '')
  return posts
    .map((p) => `- **[${p.title}](${base}/writing/${p.slug})** — ${p.date}`)
    .join('\n')
}

The site side leans on the schema. Trimmed to the parts that matter:

const posts = defineCollection({
  loader: glob({ pattern: '**/*.{md,mdx}', base: '../content/posts' }),
  schema: z.object({
    title: z.string().min(1).max(90),
    date: z.coerce.date(),
    slug: z.string().regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/),
    summary: z.string().min(1).max(220),
    draft: z.boolean().default(false),
    faq: z.array(z.object({ q: z.string(), a: z.string() })).default([]),
  }),
})

And the diagram export, which runs in Node while the site builds. register() has to run before the import, or Node rejects a JSON file inside the package:

await register('./excalidraw-loader.mjs', import.meta.url)
const { exportToSvg } = await import('@excalidraw/excalidraw')
const svg = await exportToSvg({
  elements: scene.elements,
  appState: {
    ...scene.appState,
    exportBackground: false,
    exportWithDarkMode: false,
    viewBackgroundColor: 'transparent',
  },
  files: scene.files ?? null,
  exportPadding: 16,
  skipInliningFonts: true,
})

The mood preload is the one slightly unusual trick. The shuffle-bag function is self-contained on purpose, so the home page can turn it into a string and inline it into <head> with the catalogue:

export function firstMoodPreloadScript(moods: MoodSlot[]): string {
  const args = [moods.map(({ id, src }) => ({ id, src })), MOOD_CYCLE_KEY, DESKTOP_MQ]
    .map((v) => JSON.stringify(v).replace(/</g, '\\u003c'))
    .join(',')
  return `(${preloadFirstMood})(${args},${createMoodBag})`
}

The head script and the React island run literally the same shuffle code, so they can’t disagree about which mood comes next. Escaping < keeps a stray character in the data from closing the script tag.

The RSS endpoint, nearly in full:

export async function GET(context: { site?: URL }) {
  const posts = await getPublishedPosts()
  return rss({
    title: site.github.name,
    description: site.fullDescription,
    site: context.site ?? site.siteUrl,
    items: posts.map((post) => ({
      title: post.data.title,
      description: post.data.summary,
      pubDate: post.data.date,
      link: postPath(post.data.slug),
    })),
  })
}

And the legacy redirect, which is the whole file:

---
export async function getStaticPaths() {
  const posts = await getPublishedPosts()
  return posts.map((post) => ({ params: { slug: post.data.slug } }))
}
return Astro.redirect(postPath(Astro.params.slug!), 301)
---

The full files are posts.ts, web/src/content.config.ts, web/scripts/bake-diagrams.mjs, web/src/components/ExcalidrawBoard.astro, web/src/components/moods/preload.ts, web/src/pages/rss.xml.ts and web/src/pages/llms.txt.ts in the repo.

Results

I measured these from the production build (npm run build:web) and the browser’s network panel:

  • One edit, both surfaces. Changing my bio or publishing a post is one commit. The README and the site both pick it up on the next push to master, with no copy step.
  • A plain post ships no React. I measured web/dist after npm run build in web/. hello-world references one external script, the palette listener at 2.3 KB (1.2 KB gzipped). The shared stylesheet is 45.0 KB (9.5 KB gzipped). The home page HTML is 25.8 KB (8.1 KB gzipped).
  • Diagrams do not ship the editor. None of the client JS files in web/dist/_astro contain @excalidraw/excalidraw. The writing post’s HTML does not reference the React chunk (210.5 KB, 65.5 KB gzipped). Pan and zoom are one 5.6 KB inline script (1.8 KB gzipped). The SVG is already in the HTML.
  • GitHub cards are plain HTML. They ship no script at all. Link previews add a 2.4 KB inline script, and only to posts that link to a repo or PR.
  • Diagrams got lighter. Moving from the live canvas to SVG took 145 KB of CSS off every post. Self-hosting fonts took a 1.8 MB script and a CDN request off every board.
  • Mood images cost phones nothing. The seven stills total about 540 KB, but a desktop visit downloads one up front plus one low-priority prefetch after load, and a phone downloads none.
  • Feeds stay in sync for free. RSS, llms.txt and the sitemap are rebuilt on every deploy. The sitemap has five URLs today: home, Projects, Writing and the two published posts. Moods, redirects and drafts stay out.
  • Every post ships three kinds of structured data when it has an FAQ (BlogPosting, BreadcrumbList, FAQPage), all from frontmatter I was writing anyway.
  • Drafts can’t leak. One flag hides a post from pages, RSS, the sitemap, llms.txt and the README list, because all five read the same field.

What I recommend

Share data, not layout. A JSON file and a folder of MDX are boring on purpose: any build can read them, and none of them owns the others. The README generator here is a template, a few markers and string replacement. Keep yours that dumb.

Make JavaScript earn its place per page. Astro’s client:visible and client:media did most of the work. A feature that only matters on desktop shouldn’t cost a phone anything.

If you embed diagrams, bake them to SVG when the site builds. The page has the drawing with no editor library, and a browser with JavaScript off still shows it. Keep Excalidraw installed for that bake and nowhere else. Import it from Node only after a loader that can read its JSON and CSS, and don’t inline the fonts.

Don’t do this if you only want a blog. A hosted platform will get you writing sooner. This setup pays off when you have more than one surface to keep in sync and you’d rather edit a file than a dashboard.

FAQ

Do the README and the website share any layout code?
No. They share data only. The README is filled in from a short markdown template, and the site is an Astro project with its own pages and styles.
How does a draft post stay private?
A post with draft set to true renders when I run the dev server, but the build leaves it out of pages, RSS, the sitemap, llms.txt and the README list.
Why are the diagrams SVG instead of a live Excalidraw canvas?
The live canvas flashed an empty whiteboard on load and pushed about 145 KB of editor CSS onto every post. An SVG export loads cleanly, stays sharp at any zoom and follows the theme with one CSS rule.
Does every page load React?
No. Plain posts ship no React. React loads for the home page mood on desktop. A diagram is SVG baked when the site builds, so a post that has one still does not load React or Excalidraw.