# lovishgupta2004/kafka-notification architecture

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

- Interactive diagram: https://gitdiagram.com/lovishgupta2004/kafka-notification
- Repository: https://github.com/lovishgupta2004/kafka-notification

## Overview

This Spring Boot application accepts notification requests over REST, routes EMAIL and WHATSAPP messages to different partitions of the Kafka `notifications` topic, and consumes topic messages in the `notification-group` consumer group. The producer is the internal routing layer; the consumer currently prints received messages. Kafka topics, partitions, independent consumer groups, and rebalancing are documented capabilities. Source excerpts show the REST-to-producer call and Kafka send; the README documents Kafka delivery to the listener. The application bootstrap is included, but its runtime wiring is not expanded beyond what the evidence supports.

Main entry points: [`src/main/java/com/lovish/kafka_notification/Controller/NotificationController.java`](https://github.com/lovishgupta2004/kafka-notification/blob/main/src/main/java/com/lovish/kafka_notification/Controller/NotificationController.java) (Notification Endpoint), [`src/main/java/com/lovish/kafka_notification/Service/NotificationProducer.java`](https://github.com/lovishgupta2004/kafka-notification/blob/main/src/main/java/com/lovish/kafka_notification/Service/NotificationProducer.java) (Partition Router), [`src/main/java/com/lovish/kafka_notification/KafkaNotificationApplication.java`](https://github.com/lovishgupta2004/kafka-notification/blob/main/src/main/java/com/lovish/kafka_notification/KafkaNotificationApplication.java) (Spring Boot Entry), [`src/main/java/com/lovish/kafka_notification/Service/NotificationConsumer.java`](https://github.com/lovishgupta2004/kafka-notification/blob/main/src/main/java/com/lovish/kafka_notification/Service/NotificationConsumer.java) (Notification Consumer)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_api["REST API"]
  node_controller["Notification Endpoint"]
end

subgraph group_messaging["Kafka Messaging"]
  node_producer["Partition Router"]
  node_kafka[("Kafka Broker")]
  node_consumer["Notification Consumer"]
end

subgraph group_runtime["Application Runtime"]
  node_application["Spring Boot Entry"]
end

node_requester(("API Caller"))

node_requester -->|"POST request"| node_controller
node_controller -->|"sends notification"| node_producer
node_producer -->|"publishes by type"| node_kafka
node_kafka -->|"delivers messages"| node_consumer
node_application -.->|"starts runtime"| node_controller

click node_controller "https://github.com/lovishgupta2004/kafka-notification/blob/main/src/main/java/com/lovish/kafka_notification/Controller/NotificationController.java"
click node_producer "https://github.com/lovishgupta2004/kafka-notification/blob/main/src/main/java/com/lovish/kafka_notification/Service/NotificationProducer.java"
click node_consumer "https://github.com/lovishgupta2004/kafka-notification/blob/main/src/main/java/com/lovish/kafka_notification/Service/NotificationConsumer.java"
click node_application "https://github.com/lovishgupta2004/kafka-notification/blob/main/src/main/java/com/lovish/kafka_notification/KafkaNotificationApplication.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_controller toneBlue
class node_producer,node_kafka,node_consumer toneAmber
class node_application,node_requester toneMint
```

## Components

### REST API

- [Notification Endpoint](https://github.com/lovishgupta2004/kafka-notification/blob/main/src/main/java/com/lovish/kafka_notification/Controller/NotificationController.java): `src/main/java/com/lovish/kafka_notification/Controller/NotificationController.java`

### Kafka Messaging

- [Partition Router](https://github.com/lovishgupta2004/kafka-notification/blob/main/src/main/java/com/lovish/kafka_notification/Service/NotificationProducer.java): `src/main/java/com/lovish/kafka_notification/Service/NotificationProducer.java`
- **Kafka Broker**
- [Notification Consumer](https://github.com/lovishgupta2004/kafka-notification/blob/main/src/main/java/com/lovish/kafka_notification/Service/NotificationConsumer.java): `src/main/java/com/lovish/kafka_notification/Service/NotificationConsumer.java`

### Application Runtime

- [Spring Boot Entry](https://github.com/lovishgupta2004/kafka-notification/blob/main/src/main/java/com/lovish/kafka_notification/KafkaNotificationApplication.java): `src/main/java/com/lovish/kafka_notification/KafkaNotificationApplication.java`

### Other components

- **API Caller**

## Connections

- API Caller → Notification Endpoint: POST request (evidence: `README.md`)
- Notification Endpoint → Partition Router: sends notification (evidence: `src/main/java/com/lovish/kafka_notification/Controller/NotificationController.java`)
- Partition Router → Kafka Broker: publishes by type (evidence: `src/main/java/com/lovish/kafka_notification/Service/NotificationProducer.java`)
- Kafka Broker → Notification Consumer: delivers messages (evidence: `README.md`)
- Spring Boot Entry → Notification Endpoint: starts runtime
