# patrykslomka/ada2025 architecture

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

- Interactive diagram: https://gitdiagram.com/patrykslomka/ada2025
- Repository: https://github.com/patrykslomka/ada2025

## Overview

##### Project Type and Purpose
- The repository is not a single monolithic system but rather a series of labs (lab1, lab2, lab3, lab4, lab6, lab7) exploring different aspects of modern cloud-native and data-driven architectures.
- The labs span topics like deploying ML prediction and training APIs (lab1 and lab3), experimenting with Kubernetes manifests for containerized deployments (lab1, lab2, lab4), microservices design with choreography (lab6), and API gateway setups (lab7).

##### Analyzing the File Structure
- Notice that many subdirectories are organized per lab. Each lab contains its own components – for example, lab1 has both “prediction-api” and “training-api” (with variants that use file system persistence, as seen in directories ending in “-fs”), along with a UI component.
- Labs include deployment scripts (Dockerfiles, docker-compose.yml files, Kubernetes YAML manifests, and cloud build configurations) that indicate use of containerization, orchestration, and CI/CD pipelines.
- Several labs make use of API gateway examples and microservice communication patterns—especially lab7 (API gateway examples using Krakend) and lab6 (choreography-based microservices).

##### Recommended Components
a. Core Components and Layers:
- Lab1: Prediction API, Training API, and Prediction UI.
- Lab3: Cloud functions (gcfun1, gcfun2, gcfun3) and ML pipeline components (data ingestor, mlp_trainer) along with an embedded prediction UI.
- Lab4: Multiple delivery services (standard, with openapi, FaaS variants), gRPC examples, and a placeservice.
- Lab6: Choreography-based microservices such as inventory, notification, order record, and user services.
- Lab7: API gateway examples and load test clients.
- Deployment/Orchestration: Include a layer that features Docker, docker-compose, Kubernetes orchestrators (as seen in the manifests directories and docker-compose files), and cloud build pipelines for CI/CD.
- Data and Integration: Identify databases, model storage (e.g., NFS volumes in lab1), message brokers/pubsub components (given the “pub_sub_util.py” script in several labs), and external integrations indicated by openapi specs.

b. Relationships & Interactions:
- For labs exploring choreography (lab6), illustrate message passing or event-driven sequences between services (inventory, order, notification, etc.).

##### Architectural Patterns & Design Principles
- Containerization via Docker: show that almost every microservice includes its own Dockerfile.
- Demonstrate orchestration: group related services under Kubernetes clusters or docker-compose constructs when applicable.
- Separation of concerns: differentiate between frontend components (e.g., prediction-ui) and backend processing/API components.
- CI/CD and cloud integration: include cloud build configurations for automated deployments.

## Diagram (Mermaid)

```mermaid
flowchart TD

    subgraph "Lab 1: ML & Prediction"
        A["Lab1 Prediction API (Standard)"]:::lab1
        B["Lab1 Prediction API (FS)"]:::lab1
        C["Lab1 Training API (Standard)"]:::lab1
        D["Lab1 Training API (FS)"]:::lab1
        E["Lab1 Prediction UI"]:::lab1
        F["Lab1 Deployment Manifest"]:::lab1
        G["Lab1 Deployment Manifest (with NFS)"]:::lab1
    end

    subgraph "Lab 3: Cloud Functions & ML Pipeline"
        H["Lab3 Cloud Function 1"]:::lab3
        I["Lab3 Cloud Function 2"]:::lab3
        J["Lab3 Cloud Function 3"]:::lab3
        K["Lab3 Data Ingestor"]:::lab3
        L["Lab3 Model Trainer"]:::lab3
        M["Lab3 Embedded Prediction UI"]:::lab3
        N["Lab3 Trigger CI/CD Cloud Run"]:::lab3
        O["Lab3 Trigger Vertex AI"]:::lab3
    end

    subgraph "Lab 4: Delivery & gRPC Services"
        P["Lab4 Delivery Service with BigQuery"]:::lab4
        Q["Lab4 Standard Delivery Service"]:::lab4
        R["Lab4 Delivery Service with OpenAPI"]:::lab4
        S["Lab4 Kubernetes Manifests"]:::lab4
        T["Lab4 Delivery Service FaaS"]:::lab4
        U["Lab4 gRPC Example"]:::lab4
        V["Lab4 Placeservice"]:::lab4
    end

    subgraph "Lab 6: Choreography & Microservices"
        W["Lab6 Inventory Service (Pub/Sub)"]:::lab6
        X["Lab6 Notification Service"]:::lab6
        Y["Lab6 Order Record Service (Pub/Sub)"]:::lab6
        Z["Lab6 User Service"]:::lab6
        AA["Lab6 Exercises"]:::lab6
        AB["Lab6 Standalone Inventory Service"]:::lab6
        AC["Lab6 Order Approval Process"]:::lab6
        AD["Lab6 Standalone Order Record Service"]:::lab6
    end

    subgraph "Lab 7: API Gateway & Load Testing"
        AE["Lab7 API Gateway Example 1"]:::lab7
        AF["Lab7 API Gateway Example 2"]:::lab7
        AG["Lab7 Live API Gateway Setups"]:::lab7
        AH["Lab7 Load Test Client"]:::lab7
    end

    subgraph "Deployment & CI/CD"
        AI1["Lab1 Cloud Build (ML Components)"]:::deployment
        AI2["Lab2 Cloud Build (K8s Deployment)"]:::deployment
        AI3["Lab3 Cloud Build (Model Deployment)"]:::deployment
        AI4["Lab4 Cloud Build (Cloud Run)"]:::deployment
    end

    %% Lab 1 interactions
    E -->|"calls"| A
    E -->|"calls"| B
    A -->|"deployed_by"| F
    C -->|"deployed_by"| F
    B -->|"deployed_by"| G
    D -->|"deployed_by"| G

    %% Lab 3 interactions
    K -->|"triggers"| L
    H -->|"invokes"| M
    N -->|"triggers"| H
    O -->|"triggers"| I

    %% Lab 4 interactions
    Q -->|"managed_by"| S
    R -->|"managed_by"| S
    P -->|"managed_by"| S
    T -->|"invokes"| U
    U -->|"connects_to"| V

    %% Lab 6 interactions (Choreography flows)
    W -->|"event"| Y
    Y -->|"event"| X
    Z -->|"updates"| W
    AA -->|"executes"| AB
    AA -->|"executes"| AC
    AA -->|"executes"| AD

    %% Lab 7 interactions
    AE -->|"routes_to"| Q
    AF -->|"routes_to"| R
    AG -->|"routes_to"| T
    AH -->|"tests"| AG

    %% Deployment interactions
    AI1 -->|"deploys"| F
    AI2 -->|"deploys"| S
    AI3 -->|"deploys"| M
    AI4 -->|"deploys"| T

    %% Click Events for Lab 1
    click A "https://github.com/patrykslomka/ada2025/tree/main/lab1/prediction-api"
    click B "https://github.com/patrykslomka/ada2025/tree/main/lab1/prediction-api-fs"
    click C "https://github.com/patrykslomka/ada2025/tree/main/lab1/training-api"
    click D "https://github.com/patrykslomka/ada2025/tree/main/lab1/training-api-fs"
    click E "https://github.com/patrykslomka/ada2025/tree/main/lab1/prediction-ui"
    click F "https://github.com/patrykslomka/ada2025/tree/main/lab1/manifests"
    click G "https://github.com/patrykslomka/ada2025/tree/main/lab1/manifests_with_nfs"

    %% Click Events for Lab 3
    click H "https://github.com/patrykslomka/ada2025/tree/main/lab3/gcfun1"
    click I "https://github.com/patrykslomka/ada2025/tree/main/lab3/gcfun2"
    click J "https://github.com/patrykslomka/ada2025/tree/main/lab3/gcfun3"
    click K "https://github.com/patrykslomka/ada2025/tree/main/lab3/livelab/pipeline-components/data_ingestor"
    click L "https://github.com/patrykslomka/ada2025/tree/main/lab3/livelab/pipeline-components/mlp_trainer"
    click M "https://github.com/patrykslomka/ada2025/tree/main/lab3/livelab/prediction-ui-embedded"
    click N "https://github.com/patrykslomka/ada2025/tree/main/lab3/livelab/trigger-cicd-cloud-run"
    click O "https://github.com/patrykslomka/ada2025/tree/main/lab3/livelab/trigger-vertext-ai"

    %% Click Events for Lab 4
    click P "https://github.com/patrykslomka/ada2025/tree/main/lab4/deliveryservice-bq"
    click Q "https://github.com/patrykslomka/ada2025/tree/main/lab4/deliveryservice"
    click R "https://github.com/patrykslomka/ada2025/tree/main/lab4/deliveryservicewithopenapi"
    click S "https://github.com/patrykslomka/ada2025/tree/main/lab4/k8smanifests"
    click T "https://github.com/patrykslomka/ada2025/tree/main/lab4/livelab/deliveryservice_faas"
    click U "https://github.com/patrykslomka/ada2025/tree/main/lab4/livelab/grpc_example"
    click V "https://github.com/patrykslomka/ada2025/tree/main/lab4/livelab/placeservice"

    %% Click Events for Lab 6
    click W "https://github.com/patrykslomka/ada2025/tree/main/lab6/choreography/inventoryservice_ps"
    click X "https://github.com/patrykslomka/ada2025/tree/main/lab6/choreography/notificationservice"
    click Y "https://github.com/patrykslomka/ada2025/tree/main/lab6/choreography/orderrecordservice_ps"
    click Z "https://github.com/patrykslomka/ada2025/tree/main/lab6/choreography/user"
    click AA "https://github.com/patrykslomka/ada2025/tree/main/lab6/exercises"
    click AB "https://github.com/patrykslomka/ada2025/tree/main/lab6/inventoryservice"
    click AC "https://github.com/patrykslomka/ada2025/tree/main/lab6/orderapprovalprocess"
    click AD "https://github.com/patrykslomka/ada2025/tree/main/lab6/orderrecordservice"

    %% Click Events for Lab 7
    click AE "https://github.com/patrykslomka/ada2025/tree/main/lab7/api_gateway_example1"
    click AF "https://github.com/patrykslomka/ada2025/tree/main/lab7/api_gateway_example2"
    click AG "https://github.com/patrykslomka/ada2025/tree/main/lab7/live"
    click AH "https://github.com/patrykslomka/ada2025/tree/main/lab7/loadtestclient"

    %% Click Events for Deployment & CI/CD
    click AI1 "https://github.com/patrykslomka/ada2025/blob/main/lab1/cloudbuild_ml_components.json"
    click AI2 "https://github.com/patrykslomka/ada2025/blob/main/lab2/cloudbuild_k8s_app_deployment.json"
    click AI3 "https://github.com/patrykslomka/ada2025/blob/main/lab3/livelab/cloud_build_model_deployment.json"
    click AI4 "https://github.com/patrykslomka/ada2025/blob/main/lab4/cloudbuild_cloudrun.json"

    %% Styles
    classDef lab1 fill:#A7D8F0,stroke:#333,stroke-width:2px;
    classDef lab3 fill:#FFC3A0,stroke:#333,stroke-width:2px;
    classDef lab4 fill:#C2F9BB,stroke:#333,stroke-width:2px;
    classDef lab6 fill:#F9FFC2,stroke:#333,stroke-width:2px;
    classDef lab7 fill:#FDC3FD,stroke:#333,stroke-width:2px;
    classDef deployment fill:#D3A4F9,stroke:#333,stroke-width:2px;
```
