# razaka8/data-lakehouse-iceberg architecture

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

- Interactive diagram: https://gitdiagram.com/razaka8/data-lakehouse-iceberg
- Repository: https://github.com/razaka8/data-lakehouse-iceberg

## Overview

This repository presents an e-commerce analytics lakehouse: data from PostgreSQL, files, and an order API is intended to be ingested through Spark into Iceberg Bronze, refined in Silver, then aggregated in Gold for analytics. The sampled API code confirms order/statistics endpoints backed by PostgreSQL; the README documents the broader Spark/MinIO/Iceberg workflow. The notebook and infrastructure definitions were not sampled, so pipeline links beyond documented stages are based on README descriptions.

Main entry points: [`notebooks/00_complete_pipeline.ipynb`](https://github.com/razaka8/data-lakehouse-iceberg/blob/main/notebooks/00_complete_pipeline.ipynb) (Spark Ingestion), [`sources/api/main.py`](https://github.com/razaka8/data-lakehouse-iceberg/blob/main/sources/api/main.py) (Orders API), [`sources/postgres/init.sql`](https://github.com/razaka8/data-lakehouse-iceberg/blob/main/sources/postgres/init.sql) (PostgreSQL Sources), [`sources/files`](https://github.com/razaka8/data-lakehouse-iceberg/tree/main/sources/files) (Files)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sources["Data Sources"]
  node_jdbc_source[("PostgreSQL Sources<br/>[init.sql]")]
  node_file_source["Files"]
end

subgraph group_api["Order API"]
  node_orders_api["Orders API<br/>[main.py]"]
  node_api_db[("API PostgreSQL<br/>[init_db.sql]")]
end

subgraph group_lakehouse["Lakehouse Processing"]
  node_spark_ingest["Spark Ingestion"]
  node_bronze[("Bronze Tables")]
  node_silver["Silver Refinement"]
  node_gold[("Gold Aggregation")]
  node_iceberg[("Iceberg Storage")]
end

subgraph group_analytics["Analytics"]
end

node_api_client(("API Consumer"))
node_analytics_user(("Analytics Users"))

node_api_db -->|"queries orders"| node_orders_api
node_api_client -->|"requests orders"| node_orders_api
node_jdbc_source -.->|"ingests JDBC"| node_spark_ingest
node_file_source -.->|"ingests files"| node_spark_ingest
node_orders_api -.->|"serves orders"| node_spark_ingest
node_spark_ingest -.->|"writes raw"| node_bronze
node_bronze -.->|"cleans and joins"| node_silver
node_silver -.->|"aggregates"| node_gold
node_spark_ingest -.->|"writes tables"| node_iceberg
node_analytics_user -.->|"queries metrics"| node_gold

click node_jdbc_source "https://github.com/razaka8/data-lakehouse-iceberg/blob/main/sources/postgres/init.sql"
click node_file_source "https://github.com/razaka8/data-lakehouse-iceberg/tree/main/sources/files"
click node_orders_api "https://github.com/razaka8/data-lakehouse-iceberg/blob/main/sources/api/main.py"
click node_api_db "https://github.com/razaka8/data-lakehouse-iceberg/blob/main/sources/api/init_db.sql"
click node_spark_ingest "https://github.com/razaka8/data-lakehouse-iceberg/blob/main/notebooks/00_complete_pipeline.ipynb"
click node_bronze "https://github.com/razaka8/data-lakehouse-iceberg/blob/main/notebooks/00_complete_pipeline.ipynb"
click node_silver "https://github.com/razaka8/data-lakehouse-iceberg/blob/main/notebooks/00_complete_pipeline.ipynb"
click node_gold "https://github.com/razaka8/data-lakehouse-iceberg/blob/main/notebooks/00_complete_pipeline.ipynb"
click node_iceberg "https://github.com/razaka8/data-lakehouse-iceberg/blob/main/notebooks/00_complete_pipeline.ipynb"

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_jdbc_source,node_file_source,node_analytics_user toneBlue
class node_orders_api,node_api_db toneAmber
class node_spark_ingest,node_bronze,node_silver,node_gold,node_iceberg,node_api_client toneMint
```

## Components

### Data Sources

- [PostgreSQL Sources](https://github.com/razaka8/data-lakehouse-iceberg/blob/main/sources/postgres/init.sql): `sources/postgres/init.sql`
- [Files](https://github.com/razaka8/data-lakehouse-iceberg/tree/main/sources/files): `sources/files`

### Order API

- [Orders API](https://github.com/razaka8/data-lakehouse-iceberg/blob/main/sources/api/main.py): `sources/api/main.py`
- [API PostgreSQL](https://github.com/razaka8/data-lakehouse-iceberg/blob/main/sources/api/init_db.sql): `sources/api/init_db.sql`

### Lakehouse Processing

- [Spark Ingestion](https://github.com/razaka8/data-lakehouse-iceberg/blob/main/notebooks/00_complete_pipeline.ipynb): `notebooks/00_complete_pipeline.ipynb`
- [Bronze Tables](https://github.com/razaka8/data-lakehouse-iceberg/blob/main/notebooks/00_complete_pipeline.ipynb): `notebooks/00_complete_pipeline.ipynb`
- [Silver Refinement](https://github.com/razaka8/data-lakehouse-iceberg/blob/main/notebooks/00_complete_pipeline.ipynb): `notebooks/00_complete_pipeline.ipynb`
- [Gold Aggregation](https://github.com/razaka8/data-lakehouse-iceberg/blob/main/notebooks/00_complete_pipeline.ipynb): `notebooks/00_complete_pipeline.ipynb`
- [Iceberg Storage](https://github.com/razaka8/data-lakehouse-iceberg/blob/main/notebooks/00_complete_pipeline.ipynb): `notebooks/00_complete_pipeline.ipynb`

### Other components

- **API Consumer**
- **Analytics Users**

## Connections

- API PostgreSQL → Orders API: queries orders (evidence: `sources/api/main.py`)
- API Consumer → Orders API: requests orders (evidence: `sources/api/main.py`)
- PostgreSQL Sources → Spark Ingestion: ingests JDBC (evidence: `README.md`)
- Files → Spark Ingestion: ingests files (evidence: `README.md`)
- Orders API → Spark Ingestion: serves orders (evidence: `README.md`)
- Spark Ingestion → Bronze Tables: writes raw (evidence: `README.md`)
- Bronze Tables → Silver Refinement: cleans and joins (evidence: `README.md`)
- Silver Refinement → Gold Aggregation: aggregates (evidence: `README.md`)
- Spark Ingestion → Iceberg Storage: writes tables (evidence: `README.md`)
- Analytics Users → Gold Aggregation: queries metrics (evidence: `README.md`)
