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
- 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
Components and flows as text
| Component | Kind | Technology | Flows out |
|---|---|---|---|
| GitHub API | external service | repos · upstream PRs | → Deploy workflow: repos, upstream PRs, contributions |
| portfolio repo | service | main @ bc835de | ⇢ Deploy workflow: push to main |
| Deploy workflow | pipeline | run #2 · success | ⇢ Cloudflare Pages: deploy build + status.json |
| Cloudflare Pages | edge | checking… | → You: pages |
| You | client | this browser | → Cloudflare Pages: live status check |
How a build works
- A push to
mainor a manual run starts the build. scripts/fetch-data.mjspulls 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;
}
}
- 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.
- The build writes
/status.json, the same data the home-page diagram is drawn from, and deploys to Cloudflare Pages. - 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 checktype-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
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.
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.
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.
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.
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.
Failure modes
| Failure | Detection | Handling | Evidence |
|---|---|---|---|
| GitHub API down during a build | Fetch wrapper records the error | Build ships; the diagram node shows a warning | fetch-data.mjs |
| Inline script or style slips in | CI grep on the build output | Pull request fails before merge | ci.yml |
| Visitor has a stale page | Live status.json build differs from the page | Status line says a newer build is live | control-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.