# alexandrebulete/ddd-notification-bundle architecture

> Architecture diagram of the GitHub repository alexandrebulete/ddd-notification-bundle, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/alexandrebulete/ddd-notification-bundle
- Repository: https://github.com/alexandrebulete/ddd-notification-bundle

## Overview

DDD Notification Bundle manages standalone recipients and topic subscriptions, then resolves a notification into one asynchronous delivery per reachable recipient/channel. Recipient registration and subscription administration are available through application commands and a console command; a recipient lookup query supports management. Doctrine repositories persist domain state, while Messenger workers hand deliveries to configured channel senders. The principal notify-to-delivery flow is shown from sampled source and README; only Slack has an implementation in the tree, so other advertised transports are configuration-dependent.

Main entry points: [`src/Application/Service/Notifier.php`](https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Application/Service/Notifier.php) (Notification router), [`src/Infrastructure/Doctrine/DoctrineRecipientRepository.php`](https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Infrastructure/Doctrine/DoctrineRecipientRepository.php) (Recipient repository), [`src/DddNotificationBundle.php`](https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/DddNotificationBundle.php) (Bundle wiring), [`src/Application/Command/RegisterRecipient/RegisterRecipientHandler.php`](https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Application/Command/RegisterRecipient/RegisterRecipientHandler.php) (Recipient commands)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Entry points"]
  node_console["Subscribe console"]
  node_recipient_admin["Recipient commands"]
  node_handle_admin["Handle command"]
  node_subscription_admin["Subscription command"]
  node_recipient_query["Recipient lookup"]
end

subgraph group_domain["Notification domain"]
  node_notification["Notification value<br/>[Notification.php]"]
  node_recipient["Recipient<br/>[Recipient.php]"]
  node_subscription["Subscription<br/>[Subscription.php]"]
  node_topic["Topic<br/>[Topic.php]"]
  node_channel["Channel<br/>[Channel.php]"]
end

subgraph group_delivery["Async delivery"]
  node_notifier["Notification router<br/>[Notifier.php]"]
  node_pending["Pending delivery"]
  node_dispatcher["Messenger dispatcher"]
  node_message["Delivery message"]
  node_worker["Delivery handler"]
  node_sender_port["Channel sender port"]
end

subgraph group_infra["Infrastructure"]
  node_recipient_repo[("Recipient repository")]
  node_subscription_repo[("Subscription repository")]
  node_slack["Slack sender"]
  node_bundle["Bundle wiring"]
  node_identity["ULID generator"]
end

node_caller(("Notification caller"))
node_transport["Symfony Notifier transport"]

node_caller -->|"notifies"| node_notifier
node_console -->|"dispatches command"| node_recipient_admin
node_console -->|"dispatches command"| node_handle_admin
node_console -->|"dispatches command"| node_subscription_admin
node_recipient_admin -->|"registers"| node_recipient
node_recipient_admin -->|"saves"| node_recipient_repo
node_recipient_admin -->|"generates ID"| node_identity
node_handle_admin -->|"sets handle"| node_recipient
node_handle_admin -->|"loads and saves"| node_recipient_repo
node_subscription_admin -->|"creates"| node_subscription
node_subscription_admin -->|"saves"| node_subscription_repo
node_subscription_admin -->|"generates ID"| node_identity
node_recipient_query -->|"queries"| node_recipient_repo
node_notifier -->|"finds topic subscribers"| node_subscription_repo
node_notifier -->|"loads recipients"| node_recipient_repo
node_notifier -->|"creates"| node_pending
node_notifier -->|"dispatches"| node_dispatcher
node_dispatcher -.->|"queues"| node_message
node_message -->|"handles"| node_worker
node_worker -->|"sends through"| node_sender_port
node_slack -->|"implements"| node_sender_port
node_slack -->|"uses"| node_transport
node_bundle -->|"configures async routing"| node_dispatcher
node_bundle -->|"wires service"| node_recipient_repo
node_bundle -->|"wires service"| node_subscription_repo
node_bundle -->|"wires service"| node_slack

click node_console "https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Infrastructure/Symfony/Command/SubscribeConsoleCommand.php"
click node_recipient_admin "https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Application/Command/RegisterRecipient/RegisterRecipientHandler.php"
click node_handle_admin "https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Application/Command/SetRecipientHandle/SetRecipientHandleHandler.php"
click node_subscription_admin "https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Application/Command/Subscribe/SubscribeHandler.php"
click node_recipient_query "https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Application/Query/FindRecipients/FindRecipientsHandler.php"
click node_notifier "https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Application/Service/Notifier.php"
click node_notification "https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Domain/ValueObject/Notification.php"
click node_recipient "https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Domain/Model/Recipient.php"
click node_subscription "https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Domain/Model/Subscription.php"
click node_topic "https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Domain/ValueObject/Topic.php"
click node_channel "https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Domain/ValueObject/Channel.php"
click node_recipient_repo "https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Infrastructure/Doctrine/DoctrineRecipientRepository.php"
click node_subscription_repo "https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Infrastructure/Doctrine/DoctrineSubscriptionRepository.php"
click node_pending "https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Application/Delivery/PendingDelivery.php"
click node_dispatcher "https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Infrastructure/Messenger/MessengerDeliveryDispatcher.php"
click node_message "https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Infrastructure/Messenger/DeliverNotification.php"
click node_worker "https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Infrastructure/Messenger/DeliverNotificationHandler.php"
click node_sender_port "https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Application/Port/ChannelSenderInterface.php"
click node_slack "https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Infrastructure/Channel/SlackChannelSender.php"
click node_bundle "https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/DddNotificationBundle.php"
click node_identity "https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Infrastructure/Identity/UlidIdentityGenerator.php"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_console,node_recipient_admin,node_handle_admin,node_subscription_admin,node_recipient_query toneBlue
class node_notification,node_recipient,node_subscription,node_topic,node_channel toneAmber
class node_notifier,node_pending,node_dispatcher,node_message,node_worker,node_sender_port toneMint
class node_recipient_repo,node_subscription_repo,node_slack,node_bundle,node_identity toneRose
class node_caller,node_transport toneIndigo
```

## Components

### Entry points

- [Subscribe console](https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Infrastructure/Symfony/Command/SubscribeConsoleCommand.php): `src/Infrastructure/Symfony/Command/SubscribeConsoleCommand.php`
- [Recipient commands](https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Application/Command/RegisterRecipient/RegisterRecipientHandler.php): `src/Application/Command/RegisterRecipient/RegisterRecipientHandler.php`
- [Handle command](https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Application/Command/SetRecipientHandle/SetRecipientHandleHandler.php): `src/Application/Command/SetRecipientHandle/SetRecipientHandleHandler.php`
- [Subscription command](https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Application/Command/Subscribe/SubscribeHandler.php): `src/Application/Command/Subscribe/SubscribeHandler.php`
- [Recipient lookup](https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Application/Query/FindRecipients/FindRecipientsHandler.php): `src/Application/Query/FindRecipients/FindRecipientsHandler.php`

### Notification domain

- [Notification value](https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Domain/ValueObject/Notification.php): `src/Domain/ValueObject/Notification.php`
- [Recipient](https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Domain/Model/Recipient.php): `src/Domain/Model/Recipient.php`
- [Subscription](https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Domain/Model/Subscription.php): `src/Domain/Model/Subscription.php`
- [Topic](https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Domain/ValueObject/Topic.php): `src/Domain/ValueObject/Topic.php`
- [Channel](https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Domain/ValueObject/Channel.php): `src/Domain/ValueObject/Channel.php`

### Async delivery

- [Notification router](https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Application/Service/Notifier.php): `src/Application/Service/Notifier.php`
- [Pending delivery](https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Application/Delivery/PendingDelivery.php): `src/Application/Delivery/PendingDelivery.php`
- [Messenger dispatcher](https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Infrastructure/Messenger/MessengerDeliveryDispatcher.php): `src/Infrastructure/Messenger/MessengerDeliveryDispatcher.php`
- [Delivery message](https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Infrastructure/Messenger/DeliverNotification.php): `src/Infrastructure/Messenger/DeliverNotification.php`
- [Delivery handler](https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Infrastructure/Messenger/DeliverNotificationHandler.php): `src/Infrastructure/Messenger/DeliverNotificationHandler.php`
- [Channel sender port](https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Application/Port/ChannelSenderInterface.php): `src/Application/Port/ChannelSenderInterface.php`

### Infrastructure

- [Recipient repository](https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Infrastructure/Doctrine/DoctrineRecipientRepository.php): `src/Infrastructure/Doctrine/DoctrineRecipientRepository.php`
- [Subscription repository](https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Infrastructure/Doctrine/DoctrineSubscriptionRepository.php): `src/Infrastructure/Doctrine/DoctrineSubscriptionRepository.php`
- [Slack sender](https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Infrastructure/Channel/SlackChannelSender.php): `src/Infrastructure/Channel/SlackChannelSender.php`
- [Bundle wiring](https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/DddNotificationBundle.php): `src/DddNotificationBundle.php`
- [ULID generator](https://github.com/alexandrebulete/ddd-notification-bundle/blob/main/src/Infrastructure/Identity/UlidIdentityGenerator.php): `src/Infrastructure/Identity/UlidIdentityGenerator.php`

### Other components

- **Notification caller**
- **Symfony Notifier transport**

## Connections

- Notification caller → Notification router: notifies
- Subscribe console → Recipient commands: dispatches command (evidence: `src/Infrastructure/Symfony/Command/SubscribeConsoleCommand.php`)
- Subscribe console → Handle command: dispatches command (evidence: `src/Infrastructure/Symfony/Command/SubscribeConsoleCommand.php`)
- Subscribe console → Subscription command: dispatches command (evidence: `src/Infrastructure/Symfony/Command/SubscribeConsoleCommand.php`)
- Recipient commands → Recipient: registers (evidence: `src/Application/Command/RegisterRecipient/RegisterRecipientHandler.php`)
- Recipient commands → Recipient repository: saves (evidence: `src/Application/Command/RegisterRecipient/RegisterRecipientHandler.php`)
- Recipient commands → ULID generator: generates ID (evidence: `src/Application/Command/RegisterRecipient/RegisterRecipientHandler.php`)
- Handle command → Recipient: sets handle (evidence: `src/Application/Command/SetRecipientHandle/SetRecipientHandleHandler.php`)
- Handle command → Recipient repository: loads and saves (evidence: `src/Application/Command/SetRecipientHandle/SetRecipientHandleHandler.php`)
- Subscription command → Subscription: creates (evidence: `src/Application/Command/Subscribe/SubscribeHandler.php`)
- Subscription command → Subscription repository: saves (evidence: `src/Application/Command/Subscribe/SubscribeHandler.php`)
- Subscription command → ULID generator: generates ID (evidence: `src/Application/Command/Subscribe/SubscribeHandler.php`)
- Recipient lookup → Recipient repository: queries (evidence: `src/Application/Query/FindRecipients/FindRecipientsHandler.php`)
- Notification router → Subscription repository: finds topic subscribers (evidence: `src/Application/Service/Notifier.php`)
- Notification router → Recipient repository: loads recipients (evidence: `src/Application/Service/Notifier.php`)
- Notification router → Pending delivery: creates (evidence: `src/Application/Service/Notifier.php`)
- Notification router → Messenger dispatcher: dispatches (evidence: `src/Application/Service/Notifier.php`)
- Messenger dispatcher → Delivery message: queues (evidence: `src/Infrastructure/Messenger/MessengerDeliveryDispatcher.php`)
- Delivery message → Delivery handler: handles (evidence: `src/Infrastructure/Messenger/DeliverNotificationHandler.php`)
- Delivery handler → Channel sender port: sends through (evidence: `src/Infrastructure/Messenger/DeliverNotificationHandler.php`)
- Slack sender → Channel sender port: implements (evidence: `src/Infrastructure/Channel/SlackChannelSender.php`)
- Slack sender → Symfony Notifier transport: uses
- Bundle wiring → Messenger dispatcher: configures async routing (evidence: `src/DddNotificationBundle.php`)
- Bundle wiring → Recipient repository: wires service (evidence: `config/services.php`)
- Bundle wiring → Subscription repository: wires service (evidence: `config/services.php`)
- Bundle wiring → Slack sender: wires service (evidence: `config/services.php`)
