Explanation Document Template (Diátaxis)
Understanding-oriented explanation: idea in brief, context, mechanism diagram, alternatives considered, trade-offs, misconceptions, worked example
How to use: Use it when readers need to understand why a concept or design is the way it is. Fill the context and the alternatives considered first. The main pitfall is drifting into instructions or a feature list; link to how-to guides and reference instead. and history live; don't force it into a tutorial.
Preview
Explanation: Understanding [topic]
Understanding-oriented explanation in the Diátaxis sense: the page that answers "why" and "how does it fit together". It gives context, compares alternatives and states trade-offs; it does not teach a task or list every fact. Credits the Diátaxis framework by Daniele Procida (CC BY-SA 4.0); the text is original. In the Diátaxis compass an explanation serves understanding during study (acquisition). Replace every
[bracketed]value and every passage marked Example. The worked example uses the fictional company Corvid Commerce.
Contents
Document control
| Field | Value |
|---|---|
| Document ID | [DOC-EXPL-001] |
| Version | [1.0] |
| Status | [Draft / In review / Published] |
| Owner | [@owner] |
| Reviewers | [@architect, @docs-reviewer] |
| Describes | [Component or concept] as of [product version] |
| Related decision records | [ADR-NNN] |
| Last updated | YYYY-MM-DD |
| Classification | [Public / Internal] |
Revision history
| Version | Date | Author | Change |
|---|---|---|---|
| 1.0 | 2026-10-24 | [@owner] | Updated to the standard template: context, alternatives and trade-offs sections, worked example, Diátaxis attribution |
The idea in brief
[Topic] is [plain-language definition]. It exists so that [benefit], and it behaves much like [familiar analogy].
Example: An idempotency key is a unique value that a client attaches to a request that changes state, such as creating an order in the Corvid Commerce Orders API. If the same request arrives twice with the same key, Corvid Commerce performs the action once and returns the first result again. It works like a cloakroom ticket: showing the same ticket twice returns the same coat, never a second one.
Context: the problem it solves
[Describe the conditions and the failure that the concept addresses.]
Example: Networks fail in ambiguous ways. A client sends "create order", the connection drops, and the client cannot tell whether the order was created before the failure or not. If it retries, it may charge the shopper twice. If it does not retry, it may lose a sale. Mobile checkouts on weak connections make this common, and Corvid Commerce merchants reported duplicate orders as their most expensive support category before idempotency keys were introduced. The underlying problem is that "create" is not naturally safe to repeat, while "read" and "replace" are.
How it works
[Describe the components and the flow, then show it.]
Example: The client generates a random key (Corvid Commerce recommends a
UUID) for each logical operation and sends it in the Idempotency-Key
header. On the first request, the server records the key with a
fingerprint of the request body, performs the action and stores the
response. On any later request with the same key, it compares the
fingerprint: if it matches, it returns the stored response without acting
again; if it differs, it rejects the request, because the client reused a
key for a different operation. Stored keys expire after 24 hours, which
bounds storage while covering any realistic retry window.
Alternatives considered
| Alternative | What it offers | Why it was not chosen |
|---|---|---|
| [Alternative] | [Strength] | [Reason] |
| Example: No retries, ask the shopper | Simple server | Shifts the failure to the shopper and loses sales |
| Example: Deduplicate on body content | No client change | Two genuine identical orders (the same item bought twice) would be merged |
| Example: Client-assigned order IDs (PUT) | Naturally repeatable | Requires every client to manage ID space; breaks existing integrations |
| Example: Exactly-once delivery in the network layer | Transparent to clients | Not achievable end to end across the public internet |
Trade-offs and consequences
[Describe the costs, limits and responsibilities that follow from the choice.]
Example: Idempotency keys move a small responsibility to the client: it must create one key per logical operation and keep it across retries. A client that generates a new key on every retry gets no protection at all. The server pays for storage and a lookup on every write request, which adds a few milliseconds of latency. The 24-hour expiry is a deliberate bound: a retry after that window is treated as new. Corvid Commerce chose these costs because a duplicate charge damages shopper trust far more than a small latency increase damages conversion.
| Benefit | Cost | Who carries the cost |
|---|---|---|
| [Benefit] | [Cost] | [Client / Server / Operator / User] |
| Example: Safe automatic retries | Key generation and storage in the client | Integrators |
| Example: No duplicate orders | Extra lookup on each write | Corvid Commerce platform |
When it matters and when it does not
- It matters when [conditions]. Example: you create orders, refunds or payments, and your client retries automatically or runs on mobile networks.
- You can usually ignore it when [conditions]. Example: you only read
data (
GETrequests are already safe to repeat), or you run a one-off script where a person checks each result.
Limits and common misconceptions
- [Misconception], but [reality].
- Example: "Idempotency keys make every request safe." They protect a repeated request with the same key and body. They do not prevent two different keys from creating two orders.
- Example: "The key can be the order number from my shop." Only if that number is unique per attempt to create an order and never reused for a changed basket; otherwise use a random UUID.
- Example: "A stored response means the order succeeded." The stored response may be an error. Replaying it returns the same error, by design.
Related documentation
- How-to guide: [task page]. Example: How to retry failed order requests safely.
- Reference: [facts page]. Example:
Idempotency-Keyheader reference. - Tutorial: [lesson]. Example: Your first Corvid Commerce order.
- Decision record: [ADR-NNN]. Related templates: How-To Guide
(
docs/how-to), Reference Documentation (docs/reference), Tutorial (writing/tutorial), Architecture Decision Record (dev/adr).
Standard and licence note
Structure aligned with the explanation type of the Diátaxis framework by Daniele Procida (https://diataxis.fr), which is published under the Creative Commons Attribution-ShareAlike 4.0 International licence (https://creativecommons.org/licenses/by-sa/4.0/). The framework is credited here; all text in this template is original and no Diátaxis wording is reproduced. If you add material adapted from the Diátaxis pages themselves, that adapted material must carry attribution, indicate your changes and be shared under CC BY-SA 4.0 (the ShareAlike obligation); it does not become MIT. Check https://diataxis.fr for the current guidance. Corvid Commerce is fictional. Template licence: MIT.
Related templates
Administrator Guide Template (ISO/IEC/IEEE 26514)
Admin guide – roles, architecture, access, backup/restore, monitoring, maintenance, scaling, security ops, DR, audit
Documentation & SupportAPI Changelog Template (OpenAPI 3.2, AsyncAPI 3.1)
Dated per-version API change log: additive, behavioural and breaking classes, affected operations, OpenAPI diff links, Deprecation and Sunset values, SDK versions
Documentation & SupportAPI Overview and Getting Started Template
API landing page: what it does, OpenAPI and Arazzo descriptions, base URLs, auth in 3 steps, first request, key resources, errors, limits, next steps