# mamomidev/tmomi-project architecture

> Architecture diagram of the GitHub repository mamomidev/tmomi-project, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mamomidev/tmomi-project
- Repository: https://github.com/mamomidev/tmomi-project

## Overview

##### Main Components

a) Service Components:
- tmomi-web (Frontend/API Gateway)
- tmomi-producer (Kafka Producer Service)
- tmomi-consumer (Kafka Consumer Service)

b) Infrastructure Components:
- AWS Services Layer
- Elastic Beanstalk
- Auto Scaling Group
- Application Load Balancer
- Route 53
- AWS MSK (Managed Kafka)
- CloudWatch

c) Data Storage Layer:
- MySQL Database
- Redis (for seat locking)
- Elasticsearch (for search optimization)

d) Monitoring Stack:
- Prometheus
- Grafana

**Client Layer**

**Load Balancer Layer (AWS ALB)**

**Application Layer**
- Web Service
- Producer Service
- Consumer Service

**Message Queue Layer (Kafka)**

**Data Storage Layer**
- MySQL
- Redis
- Elasticsearch

**Monitoring Layer**

##### Key Relationships to Highlight

- Traffic flow from client through ALB to web service
- Queue-based communication between producer and consumer
- Demonstrate data persistence flows to various storage systems
- Monitoring data collection paths

##### Implementation Details

Use these specific elements:
- Double lines: High-volume data paths
- Clouds: AWS services
- Rectangles: Application services

##### Ticket Booking Flow
- Client request → ALB → Web Service
- Web Service → Producer → Kafka → Consumer
- Consumer → MySQL (ticket update)
- Redis (seat locking)

##### Search Flow
- Client request → ALB → Web Service
- Web Service → Elasticsearch
- Response path back to client

##### Monitoring Flow
- Services → Prometheus
- Prometheus → Grafana
- CloudWatch integration

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Style Definitions
    classDef client fill:#2374f7,stroke:#000,stroke-width:2px,color:#fff
    classDef loadbalancer fill:#ff9900,stroke:#000,stroke-width:2px,color:#000
    classDef service fill:#85ff85,stroke:#000,stroke-width:2px,color:#000
    classDef queue fill:#ffeb3b,stroke:#000,stroke-width:2px,color:#000
    classDef storage fill:#ff5252,stroke:#000,stroke-width:2px,color:#fff
    classDef monitoring fill:#9c27b0,stroke:#000,stroke-width:2px,color:#fff
    classDef aws fill:#232f3e,stroke:#000,stroke-width:2px,color:#fff

    %% Client Layer
    Client[Client Browser]:::client

    %% AWS Infrastructure Layer
    subgraph AWS["AWS Infrastructure"]
        ALB[Application Load Balancer]:::loadbalancer
        Route53[Route 53]:::aws
        ASG[Auto Scaling Group]:::aws
        EB[Elastic Beanstalk]:::aws
        CW[CloudWatch]:::aws
    end

    %% Application Layer
    subgraph Apps["Application Services"]
        Web[tmomi-web]:::service
        Producer[tmomi-producer]:::service
        Consumer[tmomi-consumer]:::service
    end

    %% Message Queue Layer
    subgraph Queue["Message Queue"]
        Kafka[AWS MSK]:::queue
    end

    %% Data Storage Layer
    subgraph Storage["Data Storage"]
        MySQL[(MySQL DB)]:::storage
        Redis[(Redis)]:::storage
        ES[(Elasticsearch)]:::storage
    end

    %% Monitoring Layer
    subgraph Monitoring["Monitoring Stack"]
        Prometheus[Prometheus]:::monitoring
        Grafana[Grafana]:::monitoring
    end

    %% Relationships
    Client --> Route53
    Route53 --> ALB
    ALB --> Web
    Web --> Producer
    Producer --> Kafka
    Kafka --> Consumer
    Consumer --> MySQL
    Web --> Redis
    Web --> ES
    
    Web --> Prometheus
    Producer --> Prometheus
    Consumer --> Prometheus
    Prometheus --> Grafana
    
    ASG --> Web
    ASG --> Producer
    ASG --> Consumer
    EB --> ASG
    CW --> ASG

    %% Click Events
    click Web "https://github.com/mamomidev/tmomi-project/tree/main/tmomi-web"
    click Producer "https://github.com/mamomidev/tmomi-project/tree/main/tmomi-producer"
    click Consumer "https://github.com/mamomidev/tmomi-project/tree/main/tmomi-consumer"
    click AWS "https://github.com/mamomidev/tmomi-project/blob/main//.github/workflows/deploy.yml"
    
    %% Legend
    subgraph Legend
        C1[Client]:::client
        LB1[Load Balancer]:::loadbalancer
        S1[Service]:::service
        Q1[Queue]:::queue
        ST1[Storage]:::storage
        M1[Monitoring]:::monitoring
        AWS1[AWS Service]:::aws
    end
```
