This project is a domain-driven design study. It is not associated with, endorsed by or affiliated with any company, and it uses no company's code, data, logos or trademarks. All names, figures and examples are illustrative or synthetic. · November 2026
Cheap items with known prices can be kept: returnless up to 1500 cents, no parcel needed.
It reads ten facts from four contexts and makes only one synchronous call, for the label.
Four return facts go out with no price, address or name, and traces follow them over Kafka.
Turn on and prove the reverse-label route, then add lag, backlog and dead-letter metrics.
customer-returns is the retail network's Supporting, commerce-tier bounded context for returns as the shopper sees them. After an order group has shipped or been delivered, the storefront asks it to authorize the return; it decides the disposition itself from event-fed read models - KEEP (returnless, under a 1500-cent threshold with every price known)…
It authorizes returns for shipped groups, picks keep, nearest returns centre or origin node, and closes on the graded outcome.
Reverse labels are off by default, the pickup-failure path is not wired, and queue health has no metric.
Approves returns only for order groups that shipped or were delivered.
Keep it, nearest returns centre or origin node, decided in the domain.
Asks the shipping context for a label; a clear 422 when it cannot.
Shoppers cancel while authorized; stale authorizations expire after 30 days.
The graded outcome closes the return; unknown lines are recorded, not restocked.
Four facts leave via an outbox, with no price, address or free text.
Fleet observability standard (ADR 0008): every binary installs OpenTelemetry and pushes OTLP/gRPC traces and metrics to the Collector (lazy, never blocks)…
Ranked against all 47 briefed repositories (dot = one repository, highest on the left).
Authorization depends on event-fed copies: a group that just shipped is refused group-not-shipped until customer-ordering's fact…
The refusal is retryable: the same Idempotency-Key runs again once the fact lands.
Reverse labels depend on one synchronous call to the shipping context and are off by default (empty SHIPPING_LABELS_URL)…
Set SHIPPING_LABELS_URL in the chart and prove the route in a cluster.
Consumer lag, outbox backlog and dead letters have no metric; trouble there is visible only in logs, SQL and Kafka tooling
Add the three metrics; until then, read logs, SQL and Kafka tooling.
REST, MCP, A2A and /reports are unauthenticated BY DECISION (fleet-wide); access control is the in-cluster boundary
A fleet-wide decision; access control is the in-cluster boundary.
Customer Returns decides each return's destination itself, so the storefront gets an answer in one request
| Style | Hexagonal (ports and adapters), one aggregate; downstream conformist of four Open Host Services with event-fed local read models; event-driven with a transactional outbox… |
| Layout | Five binaries: cmd/api (REST :8080 + outbox relay + four Kafka consumers), cmd/mcp (Streamable HTTP :8090), cmd/a2a (JSON-RPC :8093, Agent Card), cmd/projector (analytics writer… |
| Storage | PostgreSQL only at runtime (pgx, unit of work; 4 embedded golang-migrate migrations: schema, returns stem, global idempotency keys… |
| Testing | make check (fmt, vet, lint, unit, handler and godog); 90% coverage gate over internal/domain and internal/application… |
| REST | 9 operations over 8 paths on :8080 (reports on :8092): POST|GET /return-authorizations, GET /return-authorizations/{authorizationId}… |