# abdulmalikalayande/beacon architecture

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

- Interactive diagram: https://gitdiagram.com/abdulmalikalayande/beacon
- Repository: https://github.com/abdulmalikalayande/beacon

## Overview

Beacon is a Spring Boot notification library: a host submits a request, which Beacon accepts with idempotency protection and defers until the host transaction commits before queueing delivery. Workers resolve recipient preferences, enforce channel and quiet-hour rules, render templates, and send through providers with retry and fallback; provider webhooks confirm final delivery. The README also describes batching, suppression, status tracking, and pluggable backends. Provider adapters and alternative queue backends are documented as in progress. Several subsystem paths below use existing source directories because their implementations were not sampled.

Main entry points: [`beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/listener`](https://github.com/abdulmalikalayande/beacon/tree/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/listener) (After-commit listener), [`beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core`](https://github.com/abdulmalikalayande/beacon/tree/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core) (Queue workers), [`beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/service/NotificationService.java`](https://github.com/abdulmalikalayande/beacon/blob/main/beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/service/NotificationService.java) (Notification API), [`beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/service/NotificationServiceImplementation.java`](https://github.com/abdulmalikalayande/beacon/blob/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/service/NotificationServiceImplementation.java) (Accept and deduplicate)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Request ingestion"]
  node_request["Notification request"]
  node_api["Notification API"]
  node_accept["Accept and deduplicate"]
  node_event["Accepted event"]
  node_batch["Batch audience"]
end

subgraph group_delivery["Delivery pipeline"]
  node_listener["After-commit listener"]
  node_type["Type and channel rules"]
  node_worker["Queue workers"]
  node_quiet["Quiet hours"]
  node_encryption["Context encryption"]
  node_templates["Template resolution"]
  node_render["Template rendering"]
  node_suppression[("Suppression list")]
  node_provider["Provider dispatch"]
  node_retry["Retries and fallback"]
  node_webhook["Webhook handling"]
end

subgraph group_state["State and tracking"]
  node_queue["Delivery tasks"]
  node_store[("Notification database")]
  node_status[("Delivery status")]
  node_dedup[("Deduplication store")]
end

subgraph group_integrations["Host and providers"]
  node_preference["Recipient preferences"]
  node_externalprovider["Delivery providers"]
  node_hostresolver["Host preference resolver"]
end

node_host(("Host application"))

node_host -->|"submits"| node_api
node_host -->|"provides"| node_request
node_api -->|"implemented by"| node_accept
node_accept -->|"marks key"| node_dedup
node_accept -->|"publishes"| node_event
node_event -->|"handled after commit"| node_listener
node_listener -->|"resolves recipient"| node_hostresolver
node_hostresolver -->|"returns preferences"| node_preference
node_listener -.->|"applies rules"| node_type
node_listener -->|"checks hours"| node_quiet
node_listener -->|"encrypts context"| node_encryption
node_listener -->|"creates tasks"| node_queue
node_queue -->|"persists in"| node_store
node_store -->|"polls tasks"| node_worker
node_worker -->|"resolves recipient"| node_preference
node_worker -.->|"resolves template"| node_templates
node_templates -.->|"supplies template"| node_render
node_worker -->|"renders payload"| node_render
node_worker -->|"checks contact"| node_suppression
node_worker -->|"selects provider"| node_provider
node_provider -->|"sends notification"| node_externalprovider
node_worker -->|"retries failures"| node_retry
node_retry -->|"falls back"| node_provider
node_externalprovider -->|"posts callback"| node_webhook
node_webhook -->|"updates status"| node_status
node_listener -->|"records initial status"| node_status
node_api -->|"supports audience batches"| node_batch
node_host -->|"queries status"| node_status

click node_request "https://github.com/abdulmalikalayande/beacon/blob/main/beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/request/NotificationRequest.java"
click node_api "https://github.com/abdulmalikalayande/beacon/blob/main/beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/service/NotificationService.java"
click node_accept "https://github.com/abdulmalikalayande/beacon/blob/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/service/NotificationServiceImplementation.java"
click node_event "https://github.com/abdulmalikalayande/beacon/blob/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/event/NotificationRequestedEvent.java"
click node_listener "https://github.com/abdulmalikalayande/beacon/tree/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/listener"
click node_preference "https://github.com/abdulmalikalayande/beacon/blob/main/beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/spi/UserPreferenceResolver.java"
click node_batch "https://github.com/abdulmalikalayande/beacon/blob/main/beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/spi/UserBatchSource.java"
click node_type "https://github.com/abdulmalikalayande/beacon/blob/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/defaults/DefaultNotificationTypeRegistry.java"
click node_queue "https://github.com/abdulmalikalayande/beacon/blob/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/entity/DeliveryTaskEntity.java"
click node_store "https://github.com/abdulmalikalayande/beacon/blob/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/repository/DeliveryTaskRepository.java"
click node_worker "https://github.com/abdulmalikalayande/beacon/tree/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core"
click node_quiet "https://github.com/abdulmalikalayande/beacon/tree/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core"
click node_encryption "https://github.com/abdulmalikalayande/beacon/tree/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core"
click node_templates "https://github.com/abdulmalikalayande/beacon/blob/main/beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/spi/TemplateResolver.java"
click node_render "https://github.com/abdulmalikalayande/beacon/blob/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/template/DefaultTemplateEngine.java"
click node_suppression "https://github.com/abdulmalikalayande/beacon/blob/main/beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/port/SuppressionList.java"
click node_provider "https://github.com/abdulmalikalayande/beacon/blob/main/beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/port/NotificationProvider.java"
click node_retry "https://github.com/abdulmalikalayande/beacon/blob/main/beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/port/ProviderCircuitBreaker.java"
click node_webhook "https://github.com/abdulmalikalayande/beacon/blob/main/beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/port/WebhookHandler.java"
click node_status "https://github.com/abdulmalikalayande/beacon/blob/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/entity/NotificationStatusEntity.java"
click node_dedup "https://github.com/abdulmalikalayande/beacon/blob/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/dedup/DefaultDeduplicationStore.java"

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_request,node_api,node_accept,node_event,node_batch toneBlue
class node_listener,node_type,node_worker,node_quiet,node_encryption,node_templates,node_render,node_suppression,node_provider,node_retry,node_webhook toneAmber
class node_queue,node_store,node_status,node_dedup toneMint
class node_preference,node_externalprovider,node_hostresolver toneRose
class node_host toneIndigo
```

## Components

### Request ingestion

- [Notification request](https://github.com/abdulmalikalayande/beacon/blob/main/beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/request/NotificationRequest.java): `beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/request/NotificationRequest.java`
- [Notification API](https://github.com/abdulmalikalayande/beacon/blob/main/beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/service/NotificationService.java): `beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/service/NotificationService.java`
- [Accept and deduplicate](https://github.com/abdulmalikalayande/beacon/blob/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/service/NotificationServiceImplementation.java): `beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/service/NotificationServiceImplementation.java`
- [Accepted event](https://github.com/abdulmalikalayande/beacon/blob/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/event/NotificationRequestedEvent.java): `beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/event/NotificationRequestedEvent.java`
- [Batch audience](https://github.com/abdulmalikalayande/beacon/blob/main/beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/spi/UserBatchSource.java): `beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/spi/UserBatchSource.java`

### Delivery pipeline

- [After-commit listener](https://github.com/abdulmalikalayande/beacon/tree/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/listener): `beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/listener`
- [Type and channel rules](https://github.com/abdulmalikalayande/beacon/blob/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/defaults/DefaultNotificationTypeRegistry.java): `beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/defaults/DefaultNotificationTypeRegistry.java`
- [Queue workers](https://github.com/abdulmalikalayande/beacon/tree/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core): `beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core`
- [Quiet hours](https://github.com/abdulmalikalayande/beacon/tree/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core): `beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core`
- [Context encryption](https://github.com/abdulmalikalayande/beacon/tree/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core): `beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core`
- [Template resolution](https://github.com/abdulmalikalayande/beacon/blob/main/beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/spi/TemplateResolver.java): `beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/spi/TemplateResolver.java`
- [Template rendering](https://github.com/abdulmalikalayande/beacon/blob/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/template/DefaultTemplateEngine.java): `beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/template/DefaultTemplateEngine.java`
- [Suppression list](https://github.com/abdulmalikalayande/beacon/blob/main/beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/port/SuppressionList.java): `beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/port/SuppressionList.java`
- [Provider dispatch](https://github.com/abdulmalikalayande/beacon/blob/main/beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/port/NotificationProvider.java): `beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/port/NotificationProvider.java`
- [Retries and fallback](https://github.com/abdulmalikalayande/beacon/blob/main/beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/port/ProviderCircuitBreaker.java): `beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/port/ProviderCircuitBreaker.java`
- [Webhook handling](https://github.com/abdulmalikalayande/beacon/blob/main/beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/port/WebhookHandler.java): `beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/port/WebhookHandler.java`

### State and tracking

- [Delivery tasks](https://github.com/abdulmalikalayande/beacon/blob/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/entity/DeliveryTaskEntity.java): `beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/entity/DeliveryTaskEntity.java`
- [Notification database](https://github.com/abdulmalikalayande/beacon/blob/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/repository/DeliveryTaskRepository.java): `beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/repository/DeliveryTaskRepository.java`
- [Delivery status](https://github.com/abdulmalikalayande/beacon/blob/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/entity/NotificationStatusEntity.java): `beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/entity/NotificationStatusEntity.java`
- [Deduplication store](https://github.com/abdulmalikalayande/beacon/blob/main/beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/dedup/DefaultDeduplicationStore.java): `beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/dedup/DefaultDeduplicationStore.java`

### Host and providers

- [Recipient preferences](https://github.com/abdulmalikalayande/beacon/blob/main/beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/spi/UserPreferenceResolver.java): `beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/spi/UserPreferenceResolver.java`
- **Delivery providers**
- **Host preference resolver**

### Other components

- **Host application**

## Connections

- Host application → Notification API: submits (evidence: `beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/service/NotificationService.java`)
- Host application → Notification request: provides (evidence: `beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/request/NotificationRequest.java`)
- Notification API → Accept and deduplicate: implemented by (evidence: `beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/service/NotificationService.java`)
- Accept and deduplicate → Deduplication store: marks key (evidence: `beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/service/NotificationServiceImplementation.java`)
- Accept and deduplicate → Accepted event: publishes (evidence: `beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/service/NotificationServiceImplementation.java`)
- Accepted event → After-commit listener: handled after commit (evidence: `README.md`)
- After-commit listener → Host preference resolver: resolves recipient (evidence: `README.md`)
- Host preference resolver → Recipient preferences: returns preferences (evidence: `beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/spi/UserPreferenceResolver.java`)
- After-commit listener → Type and channel rules: applies rules
- After-commit listener → Quiet hours: checks hours (evidence: `README.md`)
- After-commit listener → Context encryption: encrypts context (evidence: `README.md`)
- After-commit listener → Delivery tasks: creates tasks (evidence: `README.md`)
- Delivery tasks → Notification database: persists in (evidence: `beacon-core/src/main/java/io/github/abdulmalikalayande/beacon/core/entity/DeliveryTaskEntity.java`)
- Notification database → Queue workers: polls tasks (evidence: `README.md`)
- Queue workers → Recipient preferences: resolves recipient (evidence: `README.md`)
- Queue workers → Template resolution: resolves template
- Template resolution → Template rendering: supplies template
- Queue workers → Template rendering: renders payload
- Queue workers → Suppression list: checks contact (evidence: `README.md`)
- Queue workers → Provider dispatch: selects provider (evidence: `README.md`)
- Provider dispatch → Delivery providers: sends notification (evidence: `README.md`)
- Queue workers → Retries and fallback: retries failures (evidence: `README.md`)
- Retries and fallback → Provider dispatch: falls back (evidence: `README.md`)
- Delivery providers → Webhook handling: posts callback (evidence: `README.md`)
- Webhook handling → Delivery status: updates status (evidence: `README.md`)
- After-commit listener → Delivery status: records initial status (evidence: `README.md`)
- Notification API → Batch audience: supports audience batches (evidence: `beacon-api/src/main/java/io/github/abdulmalikalayande/beacon/api/service/NotificationService.java`)
- Host application → Delivery status: queries status
