Personal site: portfolio, experience, skills and a CV that is written in the browser.
badwatt.com · Astro · React · Tailwind · TypeScript
"The most powerful weapon on earth is the human soul on fire." — Ferdinand Foch
A single-page site with six sections (home, about, skills, experience, portfolio, contact) plus a CV generator. All the copy and imagery comes from markdown content collections, so adding a project or a job is adding a file — not touching a component.
The CV is the interesting part: pick a palette, clear a captcha, and the PDF is built in the browser with jsPDF, previewed with pdf.js and downloadable without a round trip to a server.
| Layer | Choice |
|---|---|
| Framework | Astro in server output mode (@astrojs/node) |
| Islands | React 19 |
| Styling | Tailwind CSS v4 through @tailwindcss/vite |
| Language | TypeScript, strict |
| jsPDF to build it, pdf.js to preview it (both lazily imported) | |
| Captcha | Cap |
| EmailJS | |
| Fonts | Outfit and JetBrains Mono, served through Astro's fontsource provider |
| Toolchain | Vite+ for dev, build, test, lint and format |
src/ is organised by capability, and each capability keeps the four layers inside it.
Dependencies point inward, one direction only:
src/cv/ domain/ application/ infrastructure/ ui/ the CV: model, use case, pdf, viewer
src/captcha/ application/ ui/ the token rule and the widget
src/content/ domain/ application/ the site model and how it is loaded
src/contact/ infrastructure/ ui/ EmailJS behind an adapter
src/theme/ infrastructure/ ui/ the stored preference and its toggle
src/site/ui/ components/ hooks/ sections/ layouts/ the one-page site that composes the rest
src/pages/ router and composition root
domainimports nothing but its own rules and the shared content model: no framework, no DOM, noimport.meta.env.applicationholds one function per use case and declares its ports next to it, so the rules are tested with a fake fetcher and a fake clock.infrastructureholds one adapter per port.cv/infrastructure/pdfis split by responsibility:canvasis the drawing port,markdowndraws blocks,sectionsandsidebardraw the page,generateCvowns the assets and the page loop.siteis a capability too: the six sections and the chrome. It composes the others through a declared entry point —cv/ui/CvLauncher,contact/ui/Contact,theme/ui/ThemeToggle— never by reaching into their internals.- A capability never imports another capability's
infrastructure. The captcha reaches the CV and the form throughcaptcha/application/verifyCaptcha.
Five of those rules are executable: __tests__/architecture/layers.test.ts reads every
import in src/ and fails when one of them is broken. AGENTS.md has the long version.
- pnpm — this repository does not accept npm, yarn or bun
- Node.js (the container installs the latest release with
pnpm runtime set node latest)
pnpm install
cp .env.example .env # fill in the credentials below
vp run dev # http://localhost:4321Note
vp <name> runs a built-in command and vp run <name> runs the package.json script
of the same name. They are not interchangeable: vp dev and vp build are Vite's own
commands, while this is an Astro project, so dev and build go through vp run dev and
vp run build.
| Command | What it does |
|---|---|
vp run dev |
Astro dev server on port 4321 |
vp run build |
Astro production build into dist/ |
vp run preview |
Serve the build Astro produced |
vp test |
Vitest suite |
vp run coverage |
Suite with Istanbul coverage, fails below 100% |
vp check |
Format, lint and type check (also runs on commit) |
.env.example lists every variable the site reads:
| Variable | Read by |
|---|---|
PUBLIC_CAP_URL, PUBLIC_CAP_SITE_KEY |
the captcha widget, in the browser |
CAP_SECRET |
POST /api/cap/verify, at runtime |
EMAILJS_SERVICE_ID, EMAILJS_TEMPLATE_ID |
POST /api/contact, at runtime |
EMAILJS_PUBLIC_KEY, EMAILJS_PRIVATE_KEY |
POST /api/contact, at runtime |
All of them are read from the process when a request arrives, so rotating a key or pointing the site at another captcha server is a restart, not a rebuild. The image carries no configuration at all. The two Cap values do end up in the page — the widget needs them — but nothing is baked into the image.
.env.example also declares FQDN, which nothing reads today.
Important
Without the Cap credentials the CV section cannot get past its captcha, and without the EmailJS trio the contact form fails on submit. Everything else — all six sections, the CV preview after verification — works with no secrets at all.
src/content holds the text the page renders: portfolio/, experience/,
about/ and skills/. The shape of each file is validated in
src/content.config.ts by Astro's content layer.
Adding a portfolio entry is a markdown file with three fields:
---
title: "zix"
image: "../../assets/portfolio/zix/zix.gif"
url: "https://github.com/badwatt/zix"
---
One or two sentences about what it is.The image has to exist next to the other portfolio assets; a test checks that
every entry declares title, image and url and that the file it points at is
really there, so a broken path fails the suite instead of the page.
- Pick a palette — each theme is a set of seven colours in
src/domain/cv/theme.ts. - Clear the Cap captcha. The widget hands over a token,
requestCvposts it to/api/cap/verify, and the route asks Cap whether it is genuine. - jsPDF lays the document out: a sidebar with the portrait and the contact card, job cards split across pages at period boundaries.
- pdf.js renders the preview. Both libraries are imported on demand, so the initial bundle does not carry them.
vp test # 442 tests
vp run coverage # 100% statements, branches, functions and linesCoverage is a gate, not a report: vitest.config.ts sets all four thresholds to
100%, so a line without a test fails the run. Tests are written first — see the TDD
section of AGENTS.md. The only files outside the measure are type declarations,
the content schema and generated Astro output.
The site ships as a container image, not as a checkout:
docker buildproduces it from theDockerfile: built on the official Vite+ image, run ondebian:bookworm-slimwith only the Node.js binary thatvpresolved,dist/and the production dependencies. It takes no build arguments: every value, public or secret, is read at runtime.- The image is pushed to
ghcr.io/badwatt/badwatt.com:latest. - On the host, a Podman Quadlet pulls it, passes the secret through its
EnvironmentFileand relies onAutoUpdate=registryto pick up new tags.
docker build -t ghcr.io/badwatt/badwatt.com:latest .
docker push ghcr.io/badwatt/badwatt.com:latestcompose.yml runs the same site from a bind-mounted checkout, for local or ad-hoc use.

