# bento-platform/bento architecture

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

- Interactive diagram: https://gitdiagram.com/bento-platform/bento
- Repository: https://github.com/bento-platform/bento

## Overview

##### Project type and purpose
- Bento is a docker‑based, microservices platform (full‑stack) for building data‑focused portals (‑omics science).
- It provides a Python CLI (“bentoctl”) to configure, deploy and manage a suite of interoperable microservices via Docker Compose.
- The platform includes authentication, authorization, API gateway, data services (DRS, Beacon, CBioPortal, etc.), storage (MinIO), logging (Loki/Promtail), service registry, and front‑end/web components.

##### File structure
- Top‑level orchestrator:
– docker‑compose.yaml (and env‑specific overrides: dev, local, prod)
– py_bentoctl/ (the Python CLI and its helpers, entry point, configuration)
– etc/ (environment files, templates for each service, deployment scripts)
- lib/: a directory of individual microservice subfolders, each containing its own Docker Compose YAML and config templates:
- certs/, packs/, repos/ and continuous integration workflows under .github/workflows.
- docs/: a comprehensive set of markdown files detailing each aspect (installation, deployment, adding services, migration, monitoring, reverse proxy, etc.).

##### Key insights from the README
- Must use Docker ≥25.0 and Compose ≥2.25.0; Python ≥3.9 for bentoctl.
- The README emphasizes standardized APIs, microservice reuse, and CLI‑driven orchestration.

## Diagram (Mermaid)

```mermaid
flowchart TB
  %% Orchestration Layer
  subgraph "Orchestration Layer"
    entry["entry.py"]:::orchestration
    configp["config.py"]:::orchestration
    servicesp["services.py"]:::orchestration
    dockercompose["Docker Compose\n(docker-compose*.yaml)"]:::orchestration
  end

  entry -->|uses| configp
  configp -->|initializes| servicesp
  servicesp -->|invokes| dockercompose

  %% Infrastructure Layer
  subgraph "Infrastructure Services"
    auth["Auth (Keycloak)"]:::infra
    authz["Authorization"]:::infra
    gateway["API Gateway"]:::infra
    servreg["Service Registry"]:::infra
    minio["MinIO\n(Object Storage)"]:::infra
    redis["Redis\n(Cache)"]:::infra
    logs["Loki + Promtail\n(Logging)"]:::infra
  end

  dockercompose --> auth
  dockercompose --> authz
  dockercompose --> gateway
  dockercompose --> servreg
  dockercompose --> minio
  dockercompose --> redis
  dockercompose --> logs

  %% Domain Services Layer
  subgraph "Domain Microservices"
    beacon["Beacon Service"]:::domain
    drs["DRS Service"]:::domain
    cbioportal["CBioPortal"]:::domain
    katsu["Katsu Service"]:::domain
    eventrelay["Event‑Relay"]:::domain
    notification["Notification"]:::domain
    reference["Reference"]:::domain
    wes["WES Service"]:::domain
    aggregation["Aggregation"]:::domain
    dropbox["Drop‑Box"]:::domain
    gohan["Gohan Service"]:::domain
    web["Web UI"]:::domain
    publicf["Public Façade"]:::domain
  end

  gateway -->|routes HTTP| beacon
  gateway -->|routes HTTP| drs
  gateway -->|routes HTTP| cbioportal
  gateway -->|routes HTTP| katsu
  gateway -->|routes HTTP| eventrelay
  gateway -->|routes HTTP| notification
  gateway -->|routes HTTP| reference
  gateway -->|routes HTTP| wes
  gateway -->|routes HTTP| aggregation
  gateway -->|routes HTTP| dropbox
  gateway -->|routes HTTP| gohan
  gateway -->|routes HTTP| web
  gateway -->|routes HTTP| publicf

  %% Service to Infrastructure
  beacon -->|stores data| minio
  drs -->|retrieves objects| minio
  cbioportal -->|caches| redis
  katsu -->|logs| logs
  eventrelay -->|publishes events| notification
  notification -->|caches| redis
  reference -->|logs| logs
  wes -->|stores workflows| minio
  aggregation -->|logs| logs
  dropbox -->|stores files| minio
  gohan -->|caches| redis
  web -->|logs| logs
  publicf -->|auth checks| auth

  %% External Clients
  subgraph "External Clients"
    clients["Researchers / Other Portals"]:::external
  end
  clients -->|HTTP Requests| gateway

  %% Click Events
  click entry "https://github.com/bento-platform/bento/blob/main/py_bentoctl/entry.py"
  click configp "https://github.com/bento-platform/bento/blob/main/py_bentoctl/config.py"
  click servicesp "https://github.com/bento-platform/bento/blob/main/py_bentoctl/services.py"
  click dockercompose "https://github.com/bento-platform/bento/blob/main/docker-compose.yaml"
  click auth "https://github.com/bento-platform/bento/blob/main/lib/auth/docker-compose.auth.yaml"
  click authz "https://github.com/bento-platform/bento/blob/main/lib/authz/docker-compose.authz.yaml"
  click gateway "https://github.com/bento-platform/bento/blob/main/lib/gateway/docker-compose.gateway.yaml"
  click servreg "https://github.com/bento-platform/bento/blob/main/lib/service‑registry/docker-compose.service‑registry.yaml"
  click logs "https://github.com/bento-platform/bento/blob/main/lib/logs/docker-compose.logs.yaml"
  click minio "https://github.com/bento-platform/bento/blob/main/lib/minio/docker-compose.minio.yaml"
  click redis "https://github.com/bento-platform/bento/blob/main/lib/redis/docker-compose.redis.yaml"
  click beacon "https://github.com/bento-platform/bento/blob/main/lib/beacon/docker-compose.beacon.yaml"
  click drs "https://github.com/bento-platform/bento/blob/main/lib/drs/docker-compose.drs.yaml"
  click cbioportal "https://github.com/bento-platform/bento/blob/main/lib/cbioportal/docker-compose.cbioportal.yaml"
  click katsu "https://github.com/bento-platform/bento/blob/main/lib/katsu/docker-compose.katsu.yaml"
  click eventrelay "https://github.com/bento-platform/bento/blob/main/lib/event-relay/docker-compose.event-relay.yaml"
  click notification "https://github.com/bento-platform/bento/blob/main/lib/notification/docker-compose.notification.yaml"
  click reference "https://github.com/bento-platform/bento/blob/main/lib/reference/docker-compose.reference.yaml"
  click wes "https://github.com/bento-platform/bento/blob/main/lib/wes/docker-compose.wes.yaml"
  click aggregation "https://github.com/bento-platform/bento/blob/main/lib/aggregation/docker-compose.aggregation.yaml"
  click dropbox "https://github.com/bento-platform/bento/blob/main/lib/drop-box/docker-compose.drop-box.yaml"
  click gohan "https://github.com/bento-platform/bento/blob/main/lib/gohan/docker-compose.gohan.yaml"
  click web "https://github.com/bento-platform/bento/blob/main/lib/web/docker-compose.web.yaml"
  click publicf "https://github.com/bento-platform/bento/blob/main/lib/public/docker-compose.public.yaml"

  %% Styles
  classDef orchestration fill:#f9f,stroke:#333,stroke-width:1px
  classDef infra fill:#bbf,stroke:#333,stroke-width:1px
  classDef domain fill:#bfb,stroke:#333,stroke-width:1px
  classDef external fill:#ffb,stroke:#333,stroke-width:1px
```
