# zakenn/notification-service-demo architecture

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

- Interactive diagram: https://gitdiagram.com/zakenn/notification-service-demo
- Repository: https://github.com/zakenn/notification-service-demo

## Overview

1. This is a single Spring Boot service called `notification-service-demo`. Its core responsibility is to accept notification requests and send emails, with supporting audit/logging behavior and RabbitMQ integration.

2. The main application boundary is the Java Spring Boot runtime. `NotificationApplication` is the bootstrap entry point, and the project is built and run with Maven (`pom.xml`, Maven wrapper).

3. The request ingress is a REST layer in `com.notification.rest`. `NotificationController` exposes the API surface for creating or triggering notifications. The controller uses DTOs rather than domain entities, so the external contract is isolated in `NotificationDto` and `FileDto`.

4. The central business logic sits in `NotificationService`. This is where notification composition and delivery are likely coordinated, including email sending through JavaMail and any message handling needed for asynchronous flow.

5. Email delivery is the primary outbound integration. The README explicitly states the service uses JavaMail, and the demo environment points to MailHog as the SMTP target. That means emails are not sent to a real mailbox provider in the demo; they are captured by MailHog for inspection.

6. RabbitMQ is a secondary integration boundary, configured in `RabbitConfiguration`. This suggests the service can consume from or publish to a queue/exchange to decouple notification production from delivery. The configuration class is the place where the messaging topology and Spring AMQP wiring live.

7. Cross-cutting auditing/logging is handled with AOP in `AuditAspect`. This keeps logging behavior separate from the controller/service flow and indicates the app is instrumented at method or request boundaries rather than embedding audit code in business logic.

8. `NotificationConstants` centralizes shared values used by the notification flow. In an architecture diagram, this is not a runtime subsystem, but it supports consistent message subjects, paths, or other fixed configuration used across controller, service, and messaging code.

9. Configuration is split across `application.properties` and `bootstrap1.properties`. These files likely hold environment-specific settings for mail, RabbitMQ, and application defaults. The presence of bootstrap properties suggests early startup configuration is important, probably for external connectivity.

10. The `src/main/resources/images` directory implies the service may attach or embed static images in notification emails. That makes the email subsystem more than plain text and suggests the service can assemble richer email content.

11. The end-to-end data flow is: client calls REST controller → controller maps request into DTOs → service prepares notification content → service sends email via JavaMail and/or interacts with RabbitMQ → MailHog receives the SMTP traffic during demo runs. Auditing via AOP happens orthogonally around these service operations.

12. Tests are minimal in the tree, with only a basic Spring Boot application test. So the repository is architecture-focused and demo-oriented rather than a heavily tested production system.

13. Operationally, the only explicitly documented external infrastructure is Dockerized MailHog for local email capture. RabbitMQ is configured in code and should be considered another runtime dependency, even though its startup is not documented in the README.

14. In diagram terms, the key boxes are: REST API, Notification Service, Audit Aspect, RabbitMQ config/integration, and Mail delivery via JavaMail to MailHog. The important boundary is that the app mediates between synchronous HTTP input and outbound notification side effects.

Main entry points: [`src/main/java/com/notification/service/NotificationService.java`](https://github.com/zakenn/notification-service-demo/blob/master/src/main/java/com/notification/service/NotificationService.java) (Service), [`src/main/java/com/notification/rest/NotificationController.java`](https://github.com/zakenn/notification-service-demo/blob/master/src/main/java/com/notification/rest/NotificationController.java) (Controller), [`src/main/java/com/notification/NotificationApplication.java`](https://github.com/zakenn/notification-service-demo/blob/master/src/main/java/com/notification/NotificationApplication.java) (App), [`src/main/java/com/notification/aspect/AuditAspect.java`](https://github.com/zakenn/notification-service-demo/blob/master/src/main/java/com/notification/aspect/AuditAspect.java) (Audit Aspect)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Spring Boot runtime"]
  node_app(("App<br/>Spring Boot entrypoint"))
end

subgraph group_api["REST boundary"]
  node_controller["Controller"]
  node_notification_dto["Notification DTO<br/>request DTO"]
  node_file_dto["File DTO<br/>attachment DTO<br/>[FileDto.java]"]
end

subgraph group_core["Notification core"]
  node_service["Service"]
  node_constants["Constants"]
  node_audit{{"Audit Aspect<br/>AOP aspect<br/>[AuditAspect.java]"}}
end

subgraph group_integration["Outbound integrations"]
  node_rabbit_config["Rabbit Config<br/>AMQP config"]
  node_mailhog(("MailHog<br/>SMTP capture"))
end

subgraph group_config["Configuration"]
  node_app_props["App props<br/>runtime config"]
  node_bootstrap_props["Bootstrap props<br/>early config"]
end

subgraph group_build["Build"]
  node_pom["Maven POM<br/>build descriptor<br/>[pom.xml]"]
  node_mvnw["Maven Wrapper<br/>build tool"]
end

subgraph group_assets["Resources"]
  node_resources_images["Images<br/>static assets"]
end

node_app -->|"serves"| node_controller
node_controller -->|"accepts"| node_notification_dto
node_controller -->|"accepts"| node_file_dto
node_controller -->|"delegates"| node_service
node_service -->|"uses"| node_constants
node_service -->|"loads"| node_resources_images
node_service -->|"integrates"| node_rabbit_config
node_service -->|"sends email to"| node_mailhog
node_audit -.->|"wraps"| node_controller
node_audit -.->|"wraps"| node_service
node_app_props -->|"configures"| node_service
node_bootstrap_props -->|"initializes"| node_app
node_pom -->|"builds"| node_app
node_mvnw -->|"drives"| node_pom
node_rabbit_config -.->|"supports async flow"| node_mailhog

click node_app "https://github.com/zakenn/notification-service-demo/blob/master/src/main/java/com/notification/NotificationApplication.java"
click node_controller "https://github.com/zakenn/notification-service-demo/blob/master/src/main/java/com/notification/rest/NotificationController.java"
click node_notification_dto "https://github.com/zakenn/notification-service-demo/blob/master/src/main/java/com/notification/rest/dto/NotificationDto.java"
click node_file_dto "https://github.com/zakenn/notification-service-demo/blob/master/src/main/java/com/notification/rest/dto/FileDto.java"
click node_service "https://github.com/zakenn/notification-service-demo/blob/master/src/main/java/com/notification/service/NotificationService.java"
click node_constants "https://github.com/zakenn/notification-service-demo/blob/master/src/main/java/com/notification/utils/NotificationConstants.java"
click node_audit "https://github.com/zakenn/notification-service-demo/blob/master/src/main/java/com/notification/aspect/AuditAspect.java"
click node_rabbit_config "https://github.com/zakenn/notification-service-demo/blob/master/src/main/java/com/notification/config/RabbitConfiguration.java"
click node_resources_images "https://github.com/zakenn/notification-service-demo/tree/master/src/main/resources/images"
click node_app_props "https://github.com/zakenn/notification-service-demo/blob/master/src/main/resources/application.properties"
click node_bootstrap_props "https://github.com/zakenn/notification-service-demo/blob/master/src/main/resources/bootstrap1.properties"
click node_pom "https://github.com/zakenn/notification-service-demo/blob/master/pom.xml"
click node_mvnw "https://github.com/zakenn/notification-service-demo/tree/master/mvnw"

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_app,node_resources_images toneBlue
class node_controller,node_notification_dto,node_file_dto toneAmber
class node_service,node_constants,node_audit toneMint
class node_rabbit_config,node_mailhog toneRose
class node_app_props,node_bootstrap_props toneIndigo
class node_pom,node_mvnw toneTeal
```

## Components

### Spring Boot runtime

Application bootstrap and in-process request handling.

- [App](https://github.com/zakenn/notification-service-demo/blob/master/src/main/java/com/notification/NotificationApplication.java): Spring Boot entrypoint · Starts the notification-service-demo application. · `src/main/java/com/notification/NotificationApplication.java`

### REST boundary

HTTP ingress and request/response DTOs.

- [Controller](https://github.com/zakenn/notification-service-demo/blob/master/src/main/java/com/notification/rest/NotificationController.java): REST controller · Exposes the notification API surface. · `src/main/java/com/notification/rest/NotificationController.java`
- [Notification DTO](https://github.com/zakenn/notification-service-demo/blob/master/src/main/java/com/notification/rest/dto/NotificationDto.java): request DTO · External notification contract used by the REST layer. · `src/main/java/com/notification/rest/dto/NotificationDto.java`
- [File DTO](https://github.com/zakenn/notification-service-demo/blob/master/src/main/java/com/notification/rest/dto/FileDto.java): attachment DTO · Represents file data passed through the API contract. · `src/main/java/com/notification/rest/dto/FileDto.java`

### Notification core

Business logic and shared notification support.

- [Service](https://github.com/zakenn/notification-service-demo/blob/master/src/main/java/com/notification/service/NotificationService.java): business service · Coordinates notification composition and delivery. · `src/main/java/com/notification/service/NotificationService.java`
- [Constants](https://github.com/zakenn/notification-service-demo/blob/master/src/main/java/com/notification/utils/NotificationConstants.java): shared constants · Centralized values used across notification flow. · `src/main/java/com/notification/utils/NotificationConstants.java`
- [Audit Aspect](https://github.com/zakenn/notification-service-demo/blob/master/src/main/java/com/notification/aspect/AuditAspect.java): AOP aspect · Cross-cutting audit/logging around application operations. · `src/main/java/com/notification/aspect/AuditAspect.java`

### Outbound integrations

Email and messaging integration points.

- [Rabbit Config](https://github.com/zakenn/notification-service-demo/blob/master/src/main/java/com/notification/config/RabbitConfiguration.java): AMQP config · Spring RabbitMQ wiring and messaging topology setup. · `src/main/java/com/notification/config/RabbitConfiguration.java`
- **MailHog**: SMTP capture · Demo SMTP target that captures outbound email traffic.

### Configuration

Runtime and environment configuration files.

- [App props](https://github.com/zakenn/notification-service-demo/blob/master/src/main/resources/application.properties): runtime config · Primary application settings and external connectivity values. · `src/main/resources/application.properties`
- [Bootstrap props](https://github.com/zakenn/notification-service-demo/blob/master/src/main/resources/bootstrap1.properties): early config · Early startup properties for environment and connectivity. · `src/main/resources/bootstrap1.properties`

### Build

Maven build and wrapper tooling.

- [Maven POM](https://github.com/zakenn/notification-service-demo/blob/master/pom.xml): build descriptor · Defines dependencies, packaging, and build lifecycle. · `pom.xml`
- [Maven Wrapper](https://github.com/zakenn/notification-service-demo/tree/master/mvnw): build tool · Wrapper scripts and metadata used to run Maven consistently. · `mvnw`

### Resources

Static resource bundle used by notifications.

- [Images](https://github.com/zakenn/notification-service-demo/tree/master/src/main/resources/images): static assets · Images available for email composition or embedding. · `src/main/resources/images`

## Connections

- App → Controller: serves · Bootstraps the REST application context.
- Controller → Notification DTO: accepts · Maps incoming requests into the notification contract.
- Controller → File DTO: accepts · Carries attachment data in the API payload.
- Controller → Service: delegates · Hands notification execution to the service layer.
- Service → Constants: uses · Reads shared values for notification composition and routing.
- Service → Images: loads · Uses bundled images when composing richer emails.
- Service → Rabbit Config: integrates · Relies on AMQP wiring for asynchronous messaging.
- Service → MailHog: sends email to · Delivers SMTP traffic to the demo mail capture target.
- Audit Aspect → Controller: wraps · Applies cross-cutting audit/logging at API boundaries.
- Audit Aspect → Service: wraps · Applies cross-cutting audit/logging around business operations.
- App props → Service: configures · Supplies mail and messaging settings used at runtime.
- Bootstrap props → App: initializes · Provides early startup properties for the application.
- Maven POM → App: builds · Defines compilation and packaging for the runtime.
- Maven Wrapper → Maven POM: drives · Provides a consistent Maven execution entrypoint.
- Rabbit Config → MailHog: supports async flow · Messaging is part of the broader notification delivery boundary.
