Skip to content

About

Portfolio website

Resources

Stars

1 star

Watchers

1 watching

Forks

Repository files navigation

badwatt.com logo

badwatt.com

Personal site: portfolio, experience, skills and a CV that is written in the browser.
badwatt.com · Astro · React · Tailwind · TypeScript

The About section: a neon bolt in a floating card beside the headline

"The most powerful weapon on earth is the human soul on fire." — Ferdinand Foch

What it is

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.

Stack

Layer Choice
Framework Astro in server output mode (@astrojs/node)
Islands React 19
Styling Tailwind CSS v4 through @tailwindcss/vite
Language TypeScript, strict
PDF jsPDF to build it, pdf.js to preview it (both lazily imported)
Captcha Cap
Mail EmailJS
Fonts Outfit and JetBrains Mono, served through Astro's fontsource provider
Toolchain Vite+ for dev, build, test, lint and format

Architecture

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
  • domain imports nothing but its own rules and the shared content model: no framework, no DOM, no import.meta.env.
  • application holds 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.
  • infrastructure holds one adapter per port. cv/infrastructure/pdf is split by responsibility: canvas is the drawing port, markdown draws blocks, sections and sidebar draw the page, generateCv owns the assets and the page loop.
  • site is 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 through captcha/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.

Getting started

Requirements

  • pnpm — this repository does not accept npm, yarn or bun
  • Node.js (the container installs the latest release with pnpm runtime set node latest)

Install and run

pnpm install
cp .env.example .env    # fill in the credentials below
vp run dev              # http://localhost:4321

Note

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.

Commands

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)

Configuration

.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.

Content

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.

How the CV is built

  1. Pick a palette — each theme is a set of seven colours in src/domain/cv/theme.ts.
  2. Clear the Cap captcha. The widget hands over a token, requestCv posts it to /api/cap/verify, and the route asks Cap whether it is genuine.
  3. jsPDF lays the document out: a sidebar with the portrait and the contact card, job cards split across pages at period boundaries.
  4. pdf.js renders the preview. Both libraries are imported on demand, so the initial bundle does not carry them.

Testing

vp test              # 442 tests
vp run coverage      # 100% statements, branches, functions and lines

Coverage 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.

Deployment

The site ships as a container image, not as a checkout:

  1. docker build produces it from the Dockerfile: built on the official Vite+ image, run on debian:bookworm-slim with only the Node.js binary that vp resolved, dist/ and the production dependencies. It takes no build arguments: every value, public or secret, is read at runtime.
  2. The image is pushed to ghcr.io/badwatt/badwatt.com:latest.
  3. On the host, a Podman Quadlet pulls it, passes the secret through its EnvironmentFile and relies on AutoUpdate=registry to pick up new tags.
docker build -t ghcr.io/badwatt/badwatt.com:latest .
docker push ghcr.io/badwatt/badwatt.com:latest

compose.yml runs the same site from a bind-mounted checkout, for local or ad-hoc use.

About

Portfolio website

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages