# anhtranguyen-github/boomboombakudan architecture

> Architecture diagram of the GitHub repository anhtranguyen-github/boomboombakudan, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-17). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/anhtranguyen-github/boomboombakudan
- Repository: https://github.com/anhtranguyen-github/boomboombakudan

## Overview

##### Project type and purpose
- This is a real-time data-streaming pipeline for ingesting, processing, and persisting live market data from Binance.
- Key capabilities:
– A producer (BinanceProducer) that connects to Binance’s WebSocket, serializes messages (Avro), and publishes them.
– A messaging backbone (Redpanda) for buffering and distributing events.
– A consumer (BinanceConsumer) running on Spark that pulls messages, transforms/aggregates them, and writes results to Cassandra.
– Containerized deployment orchestrated via Docker Compose.

##### File structure
- Top-level directories:
– BinanceProducer/: Python scripts + Dockerfile + schemas/ + docker-compose.yaml
– BinanceConsumer/: Python/Spark code + Dockerfiles for Spark master/worker + Avro schemas + docker-compose.yaml
– Redpanda/: messaging broker compose file
– Cassandra/: Dockerfile + init scripts + compose file
– Root docker-compose.yaml ties everything together
- Patterns:
– Producer → Message Broker → Consumer → Database
– Use of Avro schemas for data contracts
– Spark cluster (master & worker) for scalable processing
– Docker Compose for local end-to-end orchestration

##### README
- Minimal content (“# BoomboomBakudan”) so piecing together architecture relies on file layout and Docker files.

a. Main components:
1. Binance WebSocket (external)
2. Producer container (BinanceProducer.py / binance-wss.py)
3. Redpanda cluster container
4. Consumer container(s) – Spark Master & Spark Worker
5. Cassandra cluster
6. Schema definitions (Avro) – could be shown as a shared contract/registry
7. Docker-Compose orchestration (root)
b. Relationships & interactions:
– Producer → Redpanda topic(s) (publish)
– Redpanda → Spark Consumer (subscribe)
– Spark Consumer → Cassandra (write)
c. Architectural patterns:
– Event-driven streaming pipeline
– Containerized microservices
– Schema-based messaging (Avro)
– Batch/stream processing on Spark
d. Key technologies:
– Python (Producers/Consumers)
– Apache Spark (stream processing)
– Redpanda (Kafka API-compatible broker)
– Apache Cassandra (NoSQL store)
– Docker & Docker Compose
– Avro schemas for serialization

## Diagram (Mermaid)

```mermaid
flowchart TB
    External["Binance WebSocket"]:::external
    subgraph "Docker Compose Environment"
        direction TB
        Producer["BinanceProducer"]:::ingestion
        Broker["Redpanda Broker"]:::messaging
        subgraph "Spark Cluster"
            direction TB
            Master["Spark Master"]:::processing
            Worker["Spark Worker"]:::processing
        end
        Consumer["BinanceConsumer"]:::processing
        DB["Cassandra"]:::storage
        SchemaRegistry["Avro Schemas"]:::schema
    end
    Orchestration["Root Docker Compose"]:::orchestration

    External -->|"WebSocket"| Producer
    Producer -->|"Kafka API"| Broker
    Broker -->|"Kafka API"| Consumer
    Consumer -->|"CQL"| DB
    Producer -->|"uses Avro"| SchemaRegistry
    Consumer -->|"uses Avro"| SchemaRegistry
    Orchestration --> Producer
    Orchestration --> Broker
    Orchestration --> Consumer
    Orchestration --> DB

    click Producer "https://github.com/anhtranguyen-github/boomboombakudan/tree/main/BinanceProducer/"
    click Broker "https://github.com/anhtranguyen-github/boomboombakudan/tree/main/Redpanda/"
    click Consumer "https://github.com/anhtranguyen-github/boomboombakudan/tree/main/BinanceConsumer/"
    click DB "https://github.com/anhtranguyen-github/boomboombakudan/tree/main/Cassandra/"
    click Orchestration "https://github.com/anhtranguyen-github/boomboombakudan/blob/main/docker-compose.yaml"

    classDef ingestion fill:#ADD8E6,stroke:#333,stroke-width:1px
    classDef messaging fill:#FFA500,stroke:#333,stroke-width:1px
    classDef processing fill:#90EE90,stroke:#333,stroke-width:1px
    classDef storage fill:#FFFFE0,stroke:#333,stroke-width:1px
    classDef external fill:#D3D3D3,stroke:#333,stroke-width:1px
    classDef orchestration fill:#EEE8AA,stroke:#333,stroke-width:1px
    classDef schema fill:#DDA0DD,stroke:#333,stroke-width:1px
```
