← all work

This site: a portfolio built like a secure pipeline

A static site whose repository list and live status diagram come from its own build, served with a strict security policy, and which only shows claims a public repository can back.

Role
Design, build and operations
Period
Nov 2026
Status
Public source
  • Astro
  • TypeScript
  • Cloudflare Pages
  • Wrangler
  • GitHub Actions
  • GitHub API
  • Content-Security-Policy
Problem
A portfolio goes stale the week it is published, and most of what portfolios claim cannot be checked.
Key decision
Generate the changing parts from the GitHub API at build time, show the build pipeline on the home page, lock the site down with strict security headers, and publish nothing a repository cannot back.
Result
A static site with no server to patch, a status diagram measured from the visitor's browser, a CSP with nothing inline, and case studies whose every decision links to a file in a public repository.

Architecture

How this site is built and servedEXTGitHub APIrepos · upstream PRsSVCportfolio repomain @ bc835deCIDeploy workflowrun #2 · successEDGECloudflare Pageschecking…CLIYouthis browserHow this site is built and servedEXTGitHub APIrepos · upstream PRsSVCportfolio repomain @ bc835deCIDeploy workflowrun #2 · successEDGECloudflare Pageschecking…CLIYouthis browser
Pushes and a nightly schedule run the deploy workflow, which pulls from the GitHub API and ships to Cloudflare Pages. Hover, tap or tab through the components; control flows are dashed.
Components and flows as text
ComponentKindTechnologyFlows out
GitHub APIexternal servicerepos · upstream PRs→ Deploy workflow: repos, upstream PRs, contributions
portfolio reposervicemain @ bc835de⇢ Deploy workflow: push to main
Deploy workflowpipelinerun #2 · success⇢ Cloudflare Pages: deploy build + status.json
Cloudflare Pagesedgechecking…→ You: pages
Youclientthis browser→ Cloudflare Pages: live status check

How a build works

  1. A push to main or a manual run starts the build.
  2. scripts/fetch-data.mjs pulls my showcased repositories from the GitHub API. Each source is wrapped so that a failure is recorded rather than thrown:
async function attempt(source, fn, fallback) {
  try {
    return await fn();
  } catch (err) {
    errors.push({ source, message: String(err.message ?? err) });
    return fallback;
  }
}
  1. Astro type-checks and builds static HTML. Diagrams are laid out at build time and emitted as SVG, so no layout code runs in the browser.
  2. The build writes /status.json, the same data the home-page diagram is drawn from, and deploys to Cloudflare Pages.
  3. In the browser, one small script measures a round trip to /status.json, marks the edge node, and reports whether a newer build is live.

Verification

  • astro check type-checks every build.
  • CI fails if the output contains inline scripts, inline styles or data: URIs that the CSP would block.
  • Every link and anchor on the live site was checked after deployment.

Decisions

  1. D-01accepted

    Every data source is optional; failures are shown, not hidden

    The build fetches each source inside a wrapper that records failures instead of throwing. A GitHub API outage produces a warning on the status diagram, not a broken site.

    Options considered

    • Fail the build when an API fails: the site cannot be updated whenever GitHub has a bad hour.
    • Ship with what is available and say so.

    Trade-off accepted

    A build can ship with a partial view; the status diagram makes that visible.

    scripts/fetch-data.mjs ↗

  2. D-02accepted

    Static output, no server

    Astro renders plain HTML at build time and Cloudflare Pages serves it from the edge. There is no runtime, no database and no API key in the browser, so there is nothing to patch or breach.

    Options considered

    • Server-side rendering with live API calls: always fresh, and a server to run, patch and rate-limit.
    • Static output, rebuilt when something changes.

    Trade-off accepted

    Content is as fresh as the last build; the footer says exactly when that was.

    astro.config.mjs ↗

  3. D-03accepted

    A strict CSP with nothing inline

    script-src and style-src are both self, frames are denied and HSTS is preloaded. All JavaScript lives in external files and diagrams are SVG with no style attributes. CI fails a pull request if the build output contains anything inline.

    Options considered

    • Allow unsafe-inline: easier, and it removes most of what a CSP is for.
    • Make the build produce nothing inline, and test for it.

    Trade-off accepted

    Some framework conveniences are off.

    public/_headers ↗ · .github/workflows/ci.yml ↗

  4. D-04accepted

    Least-privilege deployment

    The deploy workflow has read-only repository permissions and deploys with a Cloudflare token scoped to Pages only. Until that secret exists, the deploy step is skipped and the workflow still runs as a build check.

    Options considered

    • A global Cloudflare API key in CI: one leak exposes the whole account.
    • A token limited to Cloudflare Pages: Edit.

    Trade-off accepted

    One more secret to rotate.

    .github/workflows/deploy.yml ↗

  5. D-05accepted

    Only evidence-backed content

    Repositories appear only if they are on a curated showcase list, and every decision in a case study links to the file that implements it.

    Options considered

    • List every public repository automatically.
    • Curate, and cite the evidence.

    Trade-off accepted

    Less on the page; everything on it holds up.

    src/data/showcase-repos.json ↗

Failure modes

FailureDetectionHandlingEvidence
GitHub API down during a buildFetch wrapper records the errorBuild ships; the diagram node shows a warningfetch-data.mjs
Inline script or style slips inCI grep on the build outputPull request fails before mergeci.yml
Visitor has a stale pageLive status.json build differs from the pageStatus line says a newer build is livecontrol-plane.js

What I would change next

  • Add the scoped Cloudflare token so pushes and a nightly schedule deploy automatically.
  • Run link and layout checks with Playwright in CI.

Evidence index

Links point to the public repository.