---
id: platform
name: Platform
summary: |
  Provides cross-cutting capabilities for recurring scheduled triggers and durable,
  idempotent transactional email notification delivery across BookWorm.
version: 1.0.0
owners:
  - platform-engineering-team
systems:
  - id: scheduler-system
    version: 1.0.0
  - id: notification-system
    version: 1.0.0
  - id: sendgrid
    version: 1.0.0
flows:
  - id: notification-delivery
    version: 1.0.0
  - id: product-ingestion
    version: 1.0.0
badges:
  - content: Generic Domain
    backgroundColor: purple
    textColor: purple
    icon: LayersIcon
  - content: Cross-Cutting Capability
    backgroundColor: gray
    textColor: gray
    icon: ArrowsRightLeftIcon
---

## Business Purpose & Boundary

[[domain|platform]] is BookWorm's Generic bounded context for cross-cutting background job scheduling and transactional email delivery. Through [[service|scheduler-service]] and [[service|notification-api]], it emits recurring operational triggers (such as catalog vector-batch refreshes) and renders and submits order lifecycle emails via [[service|sendgrid-api]]. Explicitly **out of scope** are owning books, baskets, orders, payments, or reviews; guaranteeing recipient inbox placement after SMTP handoff; and maintaining a relational email-outbox database.

:::warning
Platform delivery outcomes and scheduled job executions **never** mutate authoritative business state in upstream domains. A successful scheduler trigger confirms event publication only—not downstream indexing completion—and email delivery status never alters an [[entity|order]]'s lifecycle state.
:::

## Core Responsibilities & Capabilities

| Capability                                              | Owning Service / Agent         | Primary Entities                |
| :------------------------------------------------------ | :----------------------------- | :------------------------------ |
| **Recurring Job Scheduling & Operational History**      | [[service\|scheduler-service]] | — (Operational schedules only)  |
| **Transactional Order Email Rendering & Deduplication** | [[service\|notification-api]]  | — (Stateless idempotency guard) |
| **External SMTP Relay Boundary**                        | [[service\|sendgrid-api]]      | — (External delivery provider)  |

## Cross-Domain Interactions (Context Map)

| Neighboring Domain / System | Direction                            | Integration Mechanism | Business Data Exchanged                                                                                                        |
| :-------------------------- | :----------------------------------- | :-------------------- | :----------------------------------------------------------------------------------------------------------------------------- |
| **[[domain\|catalog]]**     | Upstream (`Platform` → `Catalog`)    | Async (Event)         | [[event\|ProcessVectorBatchIntegrationEvent]] triggers periodic vector embedding refreshes                                     |
| **[[domain\|ordering]]**    | Downstream (`Ordering` → `Platform`) | Async (Commands)      | [[command\|PlaceOrderCommand]], [[command\|CompleteOrderCommand]], and [[command\|CancelOrderCommand]] trigger customer emails |
| **[[system\|sendgrid]]**    | Downstream (`Platform` → `SendGrid`) | Sync (SMTP)           | Rendered MIME HTML order confirmation, completion, and cancellation emails                                                     |

:::note
**Idempotency & Dead-Letter Resilience:** Because [[service|notification-api]] operates statelessly without a relational outbox, it protects customers from duplicate emails using a 24-hour Redis idempotency guard. Commands with blank recipient addresses are skipped safely, and messages that exhaust transient delivery retries route to the notification dead-letter queue for operator triage.
:::

## Ubiquitous Language Highlights

- **Vector Batch Job:** A recurring scheduled trigger that asks [[domain|catalog]] ingestion to refresh search embeddings without owning book records.
- **Idempotency Guard:** A time-bounded deduplication check ensuring repeated notification commands do not send duplicate customer emails.
- **Email Template:** Responsive email markup compiled into HTML at runtime for transactional order notifications.
- **Dead-Letter Queue:** A dedicated message channel holding commands that exhausted transient delivery retries for inspection and replay.

## Architecture Visualizations

<NodeGraph />

### Platform Context Overview

<LikeC4View viewId="platformContext" project="platform" />

## Related Governance & Documentation

- [[system|scheduler-system]] — Recurring job scheduling boundary and [[service|scheduler-service]].
- [[system|notification-system]] — Stateless email rendering and [[service|notification-api]].
- [[system|sendgrid]] — External SMTP relay boundary.
- [[flow|notification-delivery]] — End-to-end order notification delivery workflow.
- [[flow|product-ingestion]] — Scheduled vector batch trigger to Catalog ingestion.
- [[adr|adr-bw-005-kafka-integration-backbone]] — Standardized asynchronous messaging backbone.
- [[doc|arc42/12-glossary]] — Shared platform and operational terminology.
