---
id: notification-system
name: Notification System
version: 1.0.0
summary: |
  Internal platform system that consumes order commands, renders email
  templates, and submits messages over SMTP.
scope: internal
owners:
  - platform-engineering-team
services:
  - id: notification-api
    version: 1.0.0
flows:
  - id: user-checkout
    version: 1.0.0
  - id: notification-delivery
    version: 1.0.0
relationships:
  - id: sendgrid
    version: 1.0.0
    label: submits email delivery requests to
badges:
  - content: Internal
    backgroundColor: gray
    textColor: gray
    icon: LockClosedIcon
---

## System Purpose & Boundary

The Notification System centralizes transactional email rendering and SMTP delivery handoff within the [[domain|platform]] domain. It consumes order lifecycle commands from [[system|finance-system]], merges supplied order and customer context into shared email templates, and submits MIME messages to the configured mail provider ([[system|sendgrid]] in publish environments, or a local test inbox in development). Owning order business state, tracking inbox delivery/bounces, and maintaining a relational email outbox are explicitly out of scope.

:::warning
Mail-provider acceptance confirms only SMTP submission—not recipient inbox arrival or underlying order success. Calling domains retain full ownership of business state, and exhausted delivery retries route to the dead-letter Kafka topic.
:::

## Contained Capabilities

| Service / Agent               | Role in System                                                                                                 | Primary Data Store                | Interaction Style (Sync / Async)     |
| :---------------------------- | :------------------------------------------------------------------------------------------------------------- | :-------------------------------- | :----------------------------------- |
| [[service\|notification-api]] | Consumes order email commands from Kafka, deduplicates by message ID, renders templates, and submits over SMTP | Redis (24-hour idempotency cache) | Async (Kafka consumer & SMTP client) |

## External Interactions & Trust Boundaries

- **Upstream commands:** Consumes [[command|PlaceOrderCommand]], [[command|CompleteOrderCommand]], and [[command|CancelOrderCommand]] from [[system|finance-system]] over Kafka.
- **Outbound mail provider:** Submits rendered emails over authenticated SMTP to [[system|sendgrid]]; blank recipient addresses are skipped safely without failing.
- **Credential boundary:** Mail-provider credentials reside strictly in runtime secret configuration and are never logged alongside recipient addresses or message bodies.

<Accordion title="Delivery Guarantees & Retry Behavior">
	- **At-least-once handoff:** Message-ID deduplication guards against duplicate Kafka deliveries
	within 24 hours, while Finance timeout retries that emit new message IDs may trigger an additional
	email. - **Resilience:** Transient SMTP failures trigger bounded client retries before Kafka
	listener cooldowns and dead-letter routing.
</Accordion>

## System Visualizations

### System Context

<ContextDiagram />

### Component Topology

<NodeGraph />

### Architecture Decisions

<ADRTable />

## Related Documentation

- [[flow|notification-delivery]] — End-to-end notification rendering and SMTP submission flow.
- [[flow|user-checkout]] — Checkout flow triggering order placement notifications.
- [[doc|domains/bookworm/subdomains/platform/engineering/platform-integration-boundaries]] — Platform service and external provider boundaries.
