43. Design documentation and its artefacts
Answer as submitted
“Yes — I create and maintain these artefacts, and I treat keeping them current as part of the work rather than as an afterthought.”
Expanded answer
Yes, and the design decision behind all five artefacts is the same one: put the truth in one place and derive everything else from it. ER diagrams are a view of the schema rather than a document beside it — generated from the migrations, so the picture cannot show a dropped column or miss one added on a Friday — at two levels because there are two audiences, a conceptual model the business can read and a physical one with types and keys that the team reviews the change against. Database schemas are the DDL itself under version control, with forward-only migrations applied by CI and a data dictionary generated from it; the column comment is the only place a change of meaning gets recorded, so it is part of the review rather than an ornament. API contracts are machine-readable documents with a generator on one side and a validator on the other, which is what distinguishes them from a specification in a wiki: OpenAPI generated from the implementation or written first and asserted against it, event schemas in a registry with a compatibility mode, and a breaking-change diff in CI. Component and service architecture follows the C4 levels so each diagram answers one question, with the container and component views generated from the deployment manifests and the service catalogue — because the manifests are executed by the platform and therefore cannot be wrong — and with ownership and dependencies recorded as data so a review can ask whether an edge is permitted rather than squinting at a picture. Business workflows are the exception to generation, because the value is the shared understanding: the process is modelled with the owner rather than presented to them, in a versioned model that includes the exception and escalation paths, which is where the process actually lives. And the mechanism that holds it together: a documentation pipeline in the repository, where a generated artefact is regenerated in the same pull request as its source, the docs site is built from the repository on every merge so a document cannot exist outside version control, and prose is reserved for the one thing no generator can produce — the why.
| Artefact | Source of truth | How it is kept current |
|---|---|---|
| ER diagram | the migrations | generated; the committed file is compared against the generator output in CI |
| Database schema | the DDL under version control | forward-only migrations reviewed in a pull request; the dictionary is generated and shows missing where a comment is absent |
| API contract | the implementation, or the spec asserted against it | drift test against the running application, plus a breaking-change diff on every change |
| Architecture diagrams | the deployment manifests and the service catalogue | generated in CI; findings open a ticket with an owner instead of failing the build |
| Business workflows | the process model agreed with the owner | versioned in the repository; a process change requires the model to change in the same pull request |
| The mechanism | the documentation pipeline | one declared source per artefact, generation in CI, and prose only for the why |
Live design-documentation workflow proof
The running component below changes its artefact/result view through real event binding. Select an artefact to see what it contains, who reads it, and the mechanism that keeps it true.
Choose a design artefact
Select an artefact to inspect what it contains, who reads it and how it stays current.
$ entities, attributes and cardinality · generated from the migrations rather than drawn · a conceptual view for the business and a physical one for the team
The ER diagram is a view of the schema rather than a separate document: it is generated from the migrations, so it cannot show a table that no longer exists or miss one that was added on a Friday afternoon. There are two levels because there are two audiences — the conceptual model the business can read, and the physical one with types and keys that the team reviews the change against.
hand-drawn ER diagrams that can go stale: 0 the physical diagram generated from the migrations: on every release conceptual models reviewed with the business owner: yes an entity in a diagram with no table behind it: 0
What the documentation discipline buys
Source files
Select a file to inspect the proof with syntax highlighting and line numbers. The first file is the code running the component above; the others are the ER and dictionary generator, the architecture diagram generator with its drift report, and the documentation pipeline that declares a source of truth and a staleness gate per artefact.
Acceptance criteria
- Covers all five artefact types the question names, each with its audience.
- Declares one source of truth per artefact and generates what can be generated.
- Shows an interactive proof of choosing an artefact and reading the mechanism.
- Regenerates in the same pull request and gates on staleness rather than on good intentions.
- Models business workflows with the process owner, including the exception paths.