# tangweichiang/groupproject-capybara-master architecture

> Architecture diagram of the GitHub repository tangweichiang/groupproject-capybara-master, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-31). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/tangweichiang/groupproject-capybara-master
- Repository: https://github.com/tangweichiang/groupproject-capybara-master

## Overview

##### Project Type and Purpose
- This is a real-time streaming pipeline application for issue tracking. The README explains that the system ingests GitHub issue data, processes it in real time using Apache Kafka, and exposes it via both a Spring Boot–based microservice and a Telegram bot interface. The design leverages containerization (Docker) for easier deployment and includes a persistent MySQL database.

##### File Structure for Architectural Clues
- The top-level files (Dockerfile, compose.yaml, pom.xml) indicate a containerized Java/Spring Boot application.
- The “src/main/java/my/uum” folder is organized into sub-packages including:
– config (e.g., KafkaTopicConfig.java),
– entity (domain objects like Comment.java, Comment2.java),
– github (GitHubApiClient.java) for integration with external GitHub services,
– jpa (repositories and service layers for database interactions),
– kafka (KafkaConsumer1.java, KafkaConsumer2.java, KafkaProducer1.java, KafkaProducer2.java) representing the event streaming components,
– telegram (TelegramBot.java) which handles the bot interactions.
- The “src/main/resources” includes the application.properties file, which likely contains the configuration details required by Spring Boot.

##### Key Components and Their Relationships
– Spring Boot Application: The central microservice container orchestrating the components.
– Kafka Producers/Consumers: Modules that interact with Apache Kafka to stream data.
– MySQL Database: Persistent data storage for issue/comment data.
– GitHub Integration Module: Responsible for fetching issue data from GitHub.
– Telegram Bot: Provides an end-user interface for real-time interaction (commands like “/start”, “/consumer”, “/quit”).

b. Relationships and Data Flow:
– The GitHub Integration component (in the “github” package) obtains issue and comment data and may push these events to Kafka via one of the Kafka producers.
– Kafka streams the data in real time to one or more Kafka consumers.
– The consumer components then process the events; one branch can persist data via JPA into the MySQL database, while another branch drives the Telegram bot (in the “telegram” package) to notify users.
– The Spring Boot application (entry points like App.java and SpringbootKafka.java) binds these services together and configures transactional and streaming processing.

##### Important Architectural Patterns/Design Principles
- Use of Microservices—even if within a single application—for separation of concerns: each package (Kafka, GitHub, JPA, Telegram) represents a self-contained logical component.
- Real-time streaming design utilizing Apache Kafka, showing producer-consumer interaction.
- Emphasis on containerization with Docker and orchestration using Docker Compose.
- The layered approach (configuration, domain entities, service/repository, and external integrations) consistent with a typical Spring Boot MVC/REST pattern.

##### Elements
- Use clear, descriptive labels for each component (e.g., “Kafka Producer”, “Kafka Consumer”, “GitHub API Client”, “Telegram Bot”, “MySQL Database”, “Spring Boot Core”).
– From GitHub API → Kafka Producer → Kafka Topics → Kafka Consumer(s)
– From Kafka Consumer → Database (via JPA) and → Telegram Bot
– Rectangles for microservices or internal modules,
- Optionally, indicate Docker containers and the overall system orchestration using Docker Compose which ties together these individual components.

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Docker Compose"
        subgraph "Spring Boot Container"
            A["App.java"]:::spring
            B["SpringbootKafka.java"]:::spring
            D["GitHub API Client"]:::github
            E1["Kafka Producer"]:::kafka
            E2["Kafka Consumer"]:::kafka
            F["Telegram Bot"]:::telegram
        end
        G["Apache Kafka"]:::kafka
        H(["MySQL Database"]):::db
    end

    A -->|"initializes"| D
    B -->|"configures"| E1
    B -->|"configures"| E2
    D -->|"pushEvent"| E1
    E1 -->|"publishTo"| G
    G -->|"subscribe"| E2
    E2 -->|"persist"| H
    E2 -->|"notify"| F

    click A "https://github.com/tangweichiang/groupproject-capybara-master/blob/master/src/main/java/my/uum/App.java"
    click B "https://github.com/tangweichiang/groupproject-capybara-master/blob/master/src/main/java/my/uum/SpringbootKafka.java"
    click D "https://github.com/tangweichiang/groupproject-capybara-master/blob/master/src/main/java/my/uum/github/GitHubApiClient.java"
    click E1 "https://github.com/tangweichiang/groupproject-capybara-master/tree/master/src/main/java/my/uum/kafka"
    click E2 "https://github.com/tangweichiang/groupproject-capybara-master/tree/master/src/main/java/my/uum/kafka"
    click F "https://github.com/tangweichiang/groupproject-capybara-master/blob/master/src/main/java/my/uum/telegram/TelegramBot.java"
    click H "https://github.com/tangweichiang/groupproject-capybara-master/tree/master/mysql"

    classDef spring fill:#cfc,stroke:#333,stroke-width:2px;
    classDef github fill:#fcf,stroke:#333,stroke-width:2px;
    classDef kafka fill:#f9c,stroke:#333,stroke-width:2px;
    classDef telegram fill:#ccf,stroke:#333,stroke-width:2px;
    classDef db fill:#c9f,stroke:#333,stroke-width:2px;
```
