A personal website that behaves like queryable documentation. Visitors ask natural-language questions and get answers grounded in published Markdown — with source citations. All retrieval and AI inference happen in the visitor's browser. No backend, no inference API, no per-answer cost.
If a browser can't run the on-device model, it gracefully falls back to local search, and can hand the grounded prompt off to ChatGPT.
Markdown (src/content) ──build──▶ chunks + search index (public/search-index.json)
│
Browser ◀───────┘
│
MiniSearch retrieval ─▶ top chunks ─▶ WebLLM (WebGPU) ─▶ answer + Sources
└─ (no WebGPU) ─▶ top matches only
└─ Continue in ChatGPT (copies grounded prompt)
- Content — every fact lives in
src/content/**/*.mdwith frontmatter (title,description,tags). This is the single source of truth. - Build-time index —
scripts/build-index.mjssplits each doc by heading into chunks and writespublic/search-index.json, plusllms.txt/llms-full.txtfor external AI systems. Runs automatically viaprebuild. - Retrieval —
src/components/ask/search.tsloads the index into MiniSearch and returns the top-N chunks entirely client-side. - Inference —
src/components/ask/webllm.tsruns a ~1B model (Llama-3.2-1B-Instruct) via WebLLM/WebGPU. Downloaded only after the visitor clicks Enable Local AI, then cached for near-instant repeat visits. - Grounding —
src/components/ask/prompt.tsbuilds the same context-constrained prompt for both the local model and the ChatGPT handoff: only answer from context, never invent, cite sources.
pnpm install
pnpm dev # rebuilds the index, then starts Astro at http://localhost:4321
pnpm build # static output in dist/ (prebuild regenerates the index)
pnpm preview # serve the production build locallyDeploy dist/ to any static host (Cloudflare Pages, Vercel, Netlify, GitHub
Pages). No server configuration required.
Add or edit files in src/content/. Each heading (## / ###) becomes a
retrievable, individually-citable chunk. Rebuild (pnpm build) and the
index, pages, and llms.txt regenerate automatically.
Astro · React · TypeScript · MiniSearch · WebLLM · 100% static.