# anhtuans-project/track2_day28_2a202601582_haanhtuan architecture

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

- Interactive diagram: https://gitdiagram.com/anhtuans-project/track2_day28_2a202601582_haanhtuan
- Repository: https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan

## Overview

Day 28 is an educational integration lab for an AI platform. Its main workflow accepts a request through Envoy and FastAPI, publishes ingestion events to Kafka, processes them with Airflow and Spark into Delta, and serves answers using Feast features, Qdrant retrieval, MLflow release metadata, and vLLM inference. The repository also provides readiness, telemetry, and metrics capabilities. Some infrastructure and orchestration components are represented by their documented roles; their source was not sampled, so those links cite the README rather than implying inspected implementation details.

Main entry points: [`src/lab28_platform/pipeline.py`](https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/pipeline.py) (Serving orchestration), [`src/lab28_platform/api.py`](https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/api.py) (FastAPI), [`src/lab28_platform/readiness.py`](https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/readiness.py) (Readiness probes), [`src/lab28_platform/event_bus.py`](https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/event_bus.py) (Kafka event bus)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Ingestion &amp; orchestration"]
  node_envoy["Envoy gateway"]
  node_contracts["Platform contracts<br/>[contracts.py]"]
  node_kafka["Kafka event bus<br/>[event_bus.py]"]
  node_airflow["Airflow pipeline"]
end

subgraph group_data["Data &amp; retrieval"]
  node_spark["Spark Delta merge<br/>[delta_merge.py]"]
  node_delta[("Delta lakehouse<br/>[delta_store.py]")]
  node_feature_export["Feature export<br/>[feature_export.py]"]
  node_feast_repo["Feast definitions<br/>[definitions.py]"]
  node_feast["Feast feature store<br/>[feature_store.py]"]
  node_vectors[("Qdrant retrieval<br/>[vector_store.py]")]
end

subgraph group_serving["Serving &amp; releases"]
  node_api["FastAPI<br/>[api.py]"]
  node_pipeline["Serving orchestration<br/>[pipeline.py]"]
  node_registry["MLflow registry<br/>[model_registry.py]"]
  node_llm["vLLM client<br/>[llm_client.py]"]
  node_guardrails["Guardrails<br/>[guardrails.py]"]
end

subgraph group_observability["Readiness &amp; observability"]
  node_readiness["Readiness probes<br/>[readiness.py]"]
  node_telemetry["OpenTelemetry<br/>[telemetry.py]"]
  node_metrics["Prometheus metrics<br/>[metrics.py]"]
  node_monitoring["Monitoring stack"]
end

node_user(("User"))

node_user -->|"sends request"| node_envoy
node_envoy -->|"routes requests"| node_api
node_api -->|"publishes events"| node_kafka
node_kafka -->|"feeds pipeline"| node_airflow
node_airflow -->|"runs merge"| node_spark
node_spark -->|"merges data"| node_delta
node_delta -->|"provides data"| node_feature_export
node_feature_export -->|"exports features"| node_feast_repo
node_feast_repo -.->|"defines features"| node_feast
node_pipeline -->|"resolves release"| node_registry
node_pipeline -->|"reads features"| node_feast
node_pipeline -->|"retrieves sources"| node_vectors
node_pipeline -->|"requests completion"| node_llm
node_pipeline -->|"screens request"| node_guardrails
node_api -.->|"serves through"| node_pipeline
node_api -->|"validates payloads"| node_contracts
node_llm -.->|"returns answer"| node_user
node_readiness -.->|"probes health"| node_kafka
node_readiness -.->|"probes health"| node_delta
node_readiness -.->|"probes health"| node_feast
node_pipeline -->|"records timings"| node_metrics
node_telemetry -->|"exports telemetry"| node_monitoring
node_metrics -->|"feeds metrics"| node_monitoring

click node_envoy "https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/tree/main/gateway"
click node_api "https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/api.py"
click node_contracts "https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/contracts.py"
click node_kafka "https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/event_bus.py"
click node_airflow "https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/airflow/dags/lab28_ingestion_pipeline.py"
click node_spark "https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/spark/delta_merge.py"
click node_delta "https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/delta_store.py"
click node_feature_export "https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/spark/feature_export.py"
click node_feast_repo "https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/feature-repo/definitions.py"
click node_feast "https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/feature_store.py"
click node_vectors "https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/vector_store.py"
click node_pipeline "https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/pipeline.py"
click node_registry "https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/model_registry.py"
click node_llm "https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/llm_client.py"
click node_guardrails "https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/guardrails.py"
click node_readiness "https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/readiness.py"
click node_telemetry "https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/telemetry.py"
click node_metrics "https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/metrics.py"
click node_monitoring "https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/tree/main/monitoring"

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_envoy,node_contracts,node_kafka,node_airflow,node_user toneBlue
class node_spark,node_delta,node_feature_export,node_feast_repo,node_feast,node_vectors toneAmber
class node_api,node_pipeline,node_registry,node_llm,node_guardrails toneMint
class node_readiness,node_telemetry,node_metrics,node_monitoring toneRose
```

## Components

### Ingestion & orchestration

- [Envoy gateway](https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/tree/main/gateway): `gateway`
- [Platform contracts](https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/contracts.py): `src/lab28_platform/contracts.py`
- [Kafka event bus](https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/event_bus.py): `src/lab28_platform/event_bus.py`
- [Airflow pipeline](https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/airflow/dags/lab28_ingestion_pipeline.py): `airflow/dags/lab28_ingestion_pipeline.py`

### Data & retrieval

- [Spark Delta merge](https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/spark/delta_merge.py): `spark/delta_merge.py`
- [Delta lakehouse](https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/delta_store.py): `src/lab28_platform/delta_store.py`
- [Feature export](https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/spark/feature_export.py): `spark/feature_export.py`
- [Feast definitions](https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/feature-repo/definitions.py): `feature-repo/definitions.py`
- [Feast feature store](https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/feature_store.py): `src/lab28_platform/feature_store.py`
- [Qdrant retrieval](https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/vector_store.py): `src/lab28_platform/vector_store.py`

### Serving & releases

- [FastAPI](https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/api.py): `src/lab28_platform/api.py`
- [Serving orchestration](https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/pipeline.py): `src/lab28_platform/pipeline.py`
- [MLflow registry](https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/model_registry.py): `src/lab28_platform/model_registry.py`
- [vLLM client](https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/llm_client.py): `src/lab28_platform/llm_client.py`
- [Guardrails](https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/guardrails.py): `src/lab28_platform/guardrails.py`

### Readiness & observability

- [Readiness probes](https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/readiness.py): `src/lab28_platform/readiness.py`
- [OpenTelemetry](https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/telemetry.py): `src/lab28_platform/telemetry.py`
- [Prometheus metrics](https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/blob/main/src/lab28_platform/metrics.py): `src/lab28_platform/metrics.py`
- [Monitoring stack](https://github.com/anhtuans-project/track2_day28_2a202601582_haanhtuan/tree/main/monitoring): `monitoring`

### Other components

- **User**

## Connections

- User → Envoy gateway: sends request (evidence: `README.md`)
- Envoy gateway → FastAPI: routes requests (evidence: `README.md`)
- FastAPI → Kafka event bus: publishes events (evidence: `README.md`)
- Kafka event bus → Airflow pipeline: feeds pipeline (evidence: `README.md`)
- Airflow pipeline → Spark Delta merge: runs merge (evidence: `airflow/dags/lab28_ingestion_pipeline.py`)
- Spark Delta merge → Delta lakehouse: merges data (evidence: `spark/delta_merge.py`)
- Delta lakehouse → Feature export: provides data (evidence: `README.md`)
- Feature export → Feast definitions: exports features (evidence: `README.md`)
- Feast definitions → Feast feature store: defines features
- Serving orchestration → MLflow registry: resolves release (evidence: `src/lab28_platform/pipeline.py`)
- Serving orchestration → Feast feature store: reads features (evidence: `src/lab28_platform/pipeline.py`)
- Serving orchestration → Qdrant retrieval: retrieves sources (evidence: `src/lab28_platform/pipeline.py`)
- Serving orchestration → vLLM client: requests completion (evidence: `src/lab28_platform/pipeline.py`)
- Serving orchestration → Guardrails: screens request (evidence: `src/lab28_platform/pipeline.py`)
- FastAPI → Serving orchestration: serves through (evidence: `src/lab28_platform/api.py`)
- FastAPI → Platform contracts: validates payloads (evidence: `src/lab28_platform/api.py`)
- vLLM client → User: returns answer
- Readiness probes → Kafka event bus: probes health (evidence: `src/lab28_platform/readiness.py`)
- Readiness probes → Delta lakehouse: probes health (evidence: `src/lab28_platform/readiness.py`)
- Readiness probes → Feast feature store: probes health (evidence: `src/lab28_platform/readiness.py`)
- Serving orchestration → Prometheus metrics: records timings (evidence: `src/lab28_platform/pipeline.py`)
- OpenTelemetry → Monitoring stack: exports telemetry (evidence: `README.md`)
- Prometheus metrics → Monitoring stack: feeds metrics (evidence: `README.md`)
