Examples · Atlas Payments demo project

Example: an ADR for delivering webhooks

An architect records as an ADR why Atlas Payments sends webhooks from a transactional outbox: drivers, options, a checked architecture diagram and risks.

For
Architect, tech lead
Time
About 25 minutes
Plan
Writing an ADR works on Free. Editing the architecture canvas needs Solo Pro or Team; reading and exporting a saved diagram work on every plan.

After incident INC-174, merchants of Atlas Payments never heard about some captured payments: payments-api committed the payment and then died before calling the merchant's webhook. The team has to decide how webhooks are sent, and record why. This example shows the ADR the creator wrote for that decision, docs/adr/0002-outbox-for-webhook-delivery.md in the demo project.

You start with: the Atlas Payments project linked in Kitsune.

1. Name the problem and what matters#

Choose New doc → Architecture decision (ADR). On Basics, name the decision, not the feature. On Context, describe what goes wrong today. On Drivers & quality, list what any solution must keep true:

docs/adr/0002-outbox-for-webhook-delivery.md
## Context and Problem Statement

payments-api sent webhooks right after committing a payment. When the process died between the commit and the
HTTP call, merchants never heard about captured payments (INC-174). A webhook must be sent if and only if its payment
committed.

## Decision Drivers

- No lost webhook after a committed payment
- No webhook for a payment that rolled back
- Retries for up to 3 days without blocking checkout

2. Draw the architecture and let the canvas check it#

On Architecture, add the blocks (checkout-web, payments-api, payments-db, outbox-relay and the merchant endpoint) and connect them. The canvas checks the model while you draw. Draw payments-api writing payments-db and also sending payment.captured as a message, with nothing keeping the two in step. The canvas flags exactly the failure of INC-174. Noting the outbox on the interaction clears the finding.

Put payments-api and payments-db in a trust zone, and every call that crosses into it is checked against STRIDE. Give payments-db a data class, and the canvas flags any store of personal data outside a trust zone.

The ADR creator at the Architecture step: payments-api and payments-db in the bounded context Payments, inside the trust zone Payments VPC with outbox-relay; checkout-web calls in from outside and outbox-relay sends webhooks to the merchant endpoint, with the block inspector of outbox-relay beside the canvas

The diagram is written into the ADR as Mermaid, so it reads on GitHub and GitLab too:

docs/adr/0002-outbox-for-webhook-delivery.md
## Architecture

```mermaid
flowchart LR
  web["checkout-web"] -->|"POST /payments (REST)"| api["payments-api"]
  api -->|"insert payment + outbox row"| db[("payments-db")]
  relay["outbox-relay"] -->|"poll outbox"| db
  relay -->|"payment.captured (Webhook)"| merchant["Merchant endpoint"]
```

Key: solid arrow — sync request · thick arrow — data access

3. Weigh the options and decide#

On Options & trade-offs, list the options you considered. On Decision, choose one and say why, with the risks you accept and how you will check the decision holds:

docs/adr/0002-outbox-for-webhook-delivery.md
## Decision Outcome

Chosen option: "Transactional outbox with a relay", because a payment and its webhook must commit together, and the
relay can retry for days without touching checkout.

### Risks

| Risk | Characteristic | Likelihood | Impact | Score | Mitigation |
|---|---|---|---|---|---|
| Outbox table grows when merchants are down for days | Availability | 2 | 2 | 4 (medium) | Partition by day, drop delivered rows after 7 days |

### Compliance

Checked by an automated fitness function: ArchUnit — no HTTP client in the payments module; only outbox-relay calls
merchant endpoints.

Review shows the whole record. Create gives it the next number in docs/adr/.

What you have now#

  • docs/adr/0002-outbox-for-webhook-delivery.md in MADR form, with a diagram GitHub renders.
  • Canvas findings resolved before the decision was written down.
  • A record your agent can read: kitsune_get_adr_context returns it with its status, kind, top characteristics, Compliance and diagram.

Read more in ADR creator and architecture canvas.