# kwangjong/coinbase-real-time-data-pipeline architecture

> Architecture diagram of the GitHub repository kwangjong/coinbase-real-time-data-pipeline, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-03-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/kwangjong/coinbase-real-time-data-pipeline
- Repository: https://github.com/kwangjong/coinbase-real-time-data-pipeline

## Overview

##### Project’s Type and Purpose
- The project is a full-stack real-time data pipeline. It gathers cryptocurrency market data from Coinbase via a WebSocket API, processes it in real time, and then stores and visualizes the data.
- The primary components include a Java-based Kafka producer, a Go-based Kafka consumer, Apache Kafka as the messaging backbone, Apache Spark for stream processing, HDFS for raw data storage, Cassandra for historical data storage, and Grafana for visualization.
- Containerization (via Docker) and orchestration (via Kubernetes/Minikube) are integral parts of the deployment strategy.

##### File Structure for Architectural Clues
- Top-level directories are split out by service/component (e.g., java_coinbase_producer, go_kafka_consumer, spark_stream_processor, cassandra, grafana, hdfs). This separation indicates a microservice or modular architecture.
- There are dedicated Dockerfiles for each component – confirming containerized deployment, while the “k8s” directory contains Kubernetes deployment manifests, outlining service definitions and interconnections.
- Additional directories under “test” for consumer and producer indicate the presence of integration tests that simulate or validate these interactions.
- Build and configuration files (pom.xml in Java projects, build.sbt in Spark, and go.mod in Go) reveal the specific technologies and dependencies coupled with each service.

##### Extract Architectural Insights from the README
- It also explains the CI/CD pipeline using GitHub Actions for building and pushing Docker images on code changes.

## Diagram (Mermaid)

```mermaid
flowchart TD
    A["Coinbase WebSocket API"]:::external
    J["CI/CD Pipeline (GitHub Actions)"]:::pipeline

    subgraph "Kubernetes Cluster"
        I["Kubernetes Orchestrator"]:::orchestrator
        B["Java Kafka Producer"]:::service
        C["Kafka Broker"]:::service
        D["Spark Structured Streaming Processor"]:::service
        E["Go Kafka Consumer"]:::service
        F["HDFS (Raw Data Storage)"]:::db
        G["Cassandra (Historical Data Storage)"]:::db
        H["Grafana (Visualization)"]:::service
    end

    A -->|"sends_data"| B
    B -->|"publishes_to"| C
    C -->|"streams_to"| D
    C -->|"streams_to"| E
    D -->|"stores_processed_to"| G
    G -->|"feeds"| H
    E -->|"writes_raw_to"| F

    J -->|"triggers_deployment"| I

    I ---|"deploys"| B
    I ---|"deploys"| C
    I ---|"deploys"| D
    I ---|"deploys"| E
    I ---|"deploys"| F
    I ---|"deploys"| G
    I ---|"deploys"| H

    classDef external fill:#f9e79f,stroke:#d4ac0d,stroke-width:2px,color:#000;
    classDef service fill:#aed6f1,stroke:#2980b9,stroke-width:2px,color:#000;
    classDef db fill:#abebc6,stroke:#27ae60,stroke-width:2px,color:#000;
    classDef orchestrator fill:#f5b7b1,stroke:#c0392b,stroke-width:2px,color:#000;
    classDef pipeline fill:#fad7a0,stroke:#e67e22,stroke-width:2px,color:#000;

    click B "https://github.com/kwangjong/coinbase-real-time-data-pipeline/blob/main/java_coinbase_producer/src/main/java/com/kwangjong/data_pipeline/Producer.java"
    click B "https://github.com/kwangjong/coinbase-real-time-data-pipeline/blob/main/java_coinbase_producer/java_coinbase_producer.Dockerfile"
    click C "https://github.com/kwangjong/coinbase-real-time-data-pipeline/blob/main/k8s/kafka-broker.yaml"
    click D "https://github.com/kwangjong/coinbase-real-time-data-pipeline/blob/main/spark_stream_processor/spark_stream_processor/src/main/scala/Main.scala"
    click D "https://github.com/kwangjong/coinbase-real-time-data-pipeline/blob/main/spark_stream_processor/spark_stream_processor.Dockerfile"
    click E "https://github.com/kwangjong/coinbase-real-time-data-pipeline/blob/main/go_kafka_consumer/consumer.go"
    click E "https://github.com/kwangjong/coinbase-real-time-data-pipeline/blob/main/go_kafka_consumer/go_kafka_consumer.Dockerfile"
    click F "https://github.com/kwangjong/coinbase-real-time-data-pipeline/blob/main/hdfs/hdfs.Dockerfile"
    click F "https://github.com/kwangjong/coinbase-real-time-data-pipeline/blob/main/hdfs/hdfs-dn.Dockerfile"
    click F "https://github.com/kwangjong/coinbase-real-time-data-pipeline/blob/main/hdfs/hdfs-nn.Dockerfile"
    click G "https://github.com/kwangjong/coinbase-real-time-data-pipeline/blob/main/cassandra/cassandra-setup.cql"
    click G "https://github.com/kwangjong/coinbase-real-time-data-pipeline/blob/main/cassandra/cassandra.Dockerfile"
    click H "https://github.com/kwangjong/coinbase-real-time-data-pipeline/blob/main/grafana/grafana.Dockerfile"
    click H "https://github.com/kwangjong/coinbase-real-time-data-pipeline/blob/main/grafana/grafana.ini"
    click H "https://github.com/kwangjong/coinbase-real-time-data-pipeline/tree/main/grafana/configs"
    click H "https://github.com/kwangjong/coinbase-real-time-data-pipeline/tree/main/grafana/dashboards"
    click I "https://github.com/kwangjong/coinbase-real-time-data-pipeline/tree/main/k8s"
    click J "https://github.com/kwangjong/coinbase-real-time-data-pipeline/blob/main/.github/workflows/ci.yml"
```
