# manatee-project/manatee architecture

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

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

## Overview

##### Main Components Identification

a) Core Services:
- dcr_api (Data Clean Room API Service)
- dcr_monitor (Monitor Service)
- dcr_tee (Trusted Execution Environment Service)
- jupyterlab_manatee (JupyterLab Integration)

b) Infrastructure Components:
- Database (indicated by dal/db in dcr_api)
- Kubernetes (evident from deployment files)
- Cloud Infrastructure (shown by GCP-related configurations)

##### Component Relationships

- Data flow between components
- API calls
- Service dependencies
- Infrastructure relationships

##### Specific Implementation Details

Technical elements:
- Thrift API definitions (from idl/job.thrift)
- Database interactions
- TEE attestation flow
- Image building pipeline
- Job execution flow

##### Additional Elements

Include:
- Security boundaries
- Network isolation zones
- Data flow control points
- Privacy-enhancing technology integration points

- User Interface     |
- (JupyterLab Manatee) |

- ↓

- Service Layer       |
- (API/Monitor/TEE)      |

- ↓

- Infrastructure      |
- (K8s/DB/Cloud/TEE)     |

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph UI
        JL[JupyterLab with ManaTEE Extension]:::frontend
    end

    subgraph Services
        subgraph API
            DAPI[DCR API Service]:::service
            Router["API Router"]:::component
            JobH["Job Handler"]:::component
            JobS["Job Service"]:::component
            DB[(Database)]:::db
            ThriftAPI["Thrift API"]:::component
        end

        subgraph Monitor
            MON[DCR Monitor Service]:::service
            IB["Image Builder (Kaniko)"]:::component
            TEEB["TEE Backend Integration"]:::component
        end

        subgraph TEE
            TEES[DCR TEE Service]:::service
            ATT["TEE Attestation"]:::security
            GSCP["GSCP Utility"]:::component
        end
    end

    subgraph Infrastructure
        K8S["Kubernetes Cluster"]:::infra
        GCP["GCP Resources"]:::cloud
        TEEI["TEE Infrastructure"]:::security
    end

    %% Connections
    JL --> DAPI
    DAPI --> Router
    Router --> JobH
    JobH --> JobS
    JobS --> DB
    JobS --> ThriftAPI
    DAPI --> MON
    MON --> IB
    MON --> TEEB
    TEEB --> TEES
    TEES --> ATT
    TEES --> GSCP
    TEES --> TEEI
    MON --> K8S
    K8S --> GCP

    %% Click Events
    click DAPI "https://github.com/manatee-project/manatee/tree/main/app/dcr_api/"
    click MON "https://github.com/manatee-project/manatee/tree/main/app/dcr_monitor/"
    click TEES "https://github.com/manatee-project/manatee/tree/main/app/dcr_tee/"
    click JL "https://github.com/manatee-project/manatee/tree/main/app/jupyterlab_manatee/"
    click DB "https://github.com/manatee-project/manatee/tree/main/app/dcr_api/biz/dal/db/"
    click JobH "https://github.com/manatee-project/manatee/tree/main/app/dcr_api/biz/handler/job/"
    click ThriftAPI "https://github.com/manatee-project/manatee/blob/main/app/dcr_api/idl/job.thrift"
    click ATT "https://github.com/manatee-project/manatee/tree/main/app/dcr_tee/attestation/"
    click IB "https://github.com/manatee-project/manatee/tree/main/app/dcr_monitor/imagebuilder/"
    click TEEB "https://github.com/manatee-project/manatee/tree/main/app/dcr_monitor/tee_backend/"
    click K8S "https://github.com/manatee-project/manatee/tree/main/deployment/data-clean-room/"
    click GCP "https://github.com/manatee-project/manatee/tree/main/resources/global/"
    click Router "https://github.com/manatee-project/manatee/tree/main/app/dcr_api/biz/router/"
    click JobS "https://github.com/manatee-project/manatee/blob/main/app/dcr_api/biz/service/job_service.go"
    click GSCP "https://github.com/manatee-project/manatee/tree/main/app/dcr_tee/util/gscp/"

    %% Styling
    classDef frontend fill:#2196F3,stroke:#1565C0,color:white
    classDef service fill:#4CAF50,stroke:#2E7D32,color:white
    classDef component fill:#78909C,stroke:#546E7A,color:white
    classDef security fill:#FFC107,stroke:#FFA000,color:black
    classDef db fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef infra fill:#607D8B,stroke:#455A64,color:white
    classDef cloud fill:#00BCD4,stroke:#0097A7,color:white
```
