Files
portfolio/docs/codebase-index.md
T

46 lines
4.7 KiB
Markdown
Raw Normal View History

# Codebase index
Reviewed 10 November 2026 against the current source. This is a vanilla JavaScript static portfolio with hash routing, Dutch/English text, and no runtime dependencies. The source contains three projects, twelve evidence items and eight process definitions.
| File | Responsibility |
| --- | --- |
| `README.md`, `AGENTS.md` | Setup, publication workflow and contributor instructions |
| `package.json` | Node >=22 requirement and five npm commands; no dependencies |
| `content/projects/*.json` | Editable projects, each with its evidence items; display order uses `number` |
| `content/settings.json` | Profile links, pinned source revision, eight process definitions |
| `content.js` | Generated browser module; do not edit directly |
| `app.js` | DOM rendering, translations, navigation, evidence filtering and printing |
| `styles.css` | Desktop/mobile layouts, project diagrams, accessibility and print styles |
| `index.html`, `favicon.svg` | Document shell, metadata and icon |
| `scripts/content.mjs` | Validate content, generate module, scaffold a project |
| `scripts/serve.mjs` | Loopback-only static preview; compiles content when requested |
| `scripts/build.mjs` | Validate/generate content, copy five public assets to `dist/` |
| `tests/` | Content integrity and editing regression checks |
| `Dockerfile`, `.dockerignore` | Allowlisted build context; test/build in Node, then copy public assets into Nginx |
| `compose.yaml`, `.env.example` | Host binding, port, restart policy, read-only runtime, temporary storage and log rotation |
| `docker/nginx.conf` | Domain-root public-file allowlist, response headers and `/healthz` |
| `.gitignore` | Excludes `dist/`, `node_modules/`, logs and `.env` |
| `docs/content-editing.md` | Field reference, editing workflow and validation limits |
| `docs/docker-hosting.md` | Guest deployment, separate proxy topology, updates and operations |
| `docs/verification.md` | Dated current checks, historical results and remaining verification limits |
| `docs/preview.png`, `docs/mobile-preview.png` | Historical visual references; not generated or refreshed by the build |
## Rendering and dependencies
`content/ → scripts/content.mjs → content.js → app.js → main`
Routes: `#home`, `#work`, `#project/<id>`, `#evidence`, `#evidence/<code>`, `#about`. Empty hash opens home. Unknown page/project routes render an in-page 404; an unknown evidence code falls back to all processes. Language is English only for `?lang=en`, otherwise Dutch. Switching language updates the query without losing the route.
`header` and `footer` render shared navigation. `home` and `work` render project lists; `detail` renders a dossier. `processRow` derives evidence counts and links from every project's `evidence` array. Removing evidence automatically removes its process-index entries.
The compiler reads JSON files directly inside `content/projects/`, sorts by `number` using numeric-aware comparison, validates project fields and emits exports. The first project is featured and the homepage count is derived from the array; an empty portfolio is supported. The preview generates content in memory on request. Content, test and build commands regenerate the tracked module on disk.
Project IDs are stable route identifiers. Evidence paths are relative to `profile.school` at the pinned `revision`. Text pairs are `[Dutch, English]`. The existing design uses exactly three diagram nodes. Personal contribution and reflection copy is still shared placeholder text in `app.js`.
`tests/content.test.mjs` checks translations, mappings, pinned URL construction and the currently missing collaboration evidence. `tests/editor.test.mjs` checks compilation, empty collections, invalid inputs and homepage rendering with the featured project or all projects removed. Its DOM stub does not test real layout or browser interactions.
The print button opens all currently rendered process details and invokes browser printing; a filtered view prints only that process. The skip link focuses the main region without changing the route. Route changes focus main and scroll to the top. Responsive, reduced-motion and print rules live in `styles.css`.
## Exposure boundary
Editing happens in local JSON files. The preview server has no write endpoint and binds to `127.0.0.1`; it serves only `/` and the five public assets. Production ships five static files, with no editor, login, database or application backend. Docker uses an Nginx server process on port 8080 and adds `/healthz`. All content included in a build is public: only put publishable material in these files. Publish `dist/`, not the repository root. The build overwrites its five files but does not remove stale files from that directory.