# inseefrlab/onyxia architecture

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

- Interactive diagram: https://gitdiagram.com/inseefrlab/onyxia
- Repository: https://github.com/inseefrlab/onyxia

## Overview

##### Main Components
- Backend/API: There is an “api” directory (even though its internal structure is not expanded in the file tree, it is presumed to represent the API server that supports the UI). Represent this as a separate “Onyxia API Backend” component.
- External Services & Integrations:
○ Authentication: Integration with Keycloak for user authentication is evident from the Keycloak theme in the frontend.
○ Secret Management: Integration with Vault is highlighted (through the SecretManager adapter).
○ Storage: The project integrates S3 (or S3-compatible storage) managed via several S3 adapter files.

- Web Frontend communicating with the API Backend through RESTful calls or WebSocket connections.
– Keycloak for authentication
– Vault for secret management
– S3 storage for data persistence and operations

##### Architectural Patterns and Techniques
- Use of Adapter patterns on the frontend (the “core/adapters” directories for OIDC, Onyxia API, etc.)—this allows the UI to remain decoupled from the underlying backend implementations.
- The separation of concerns is clearly defined between use cases (domain logic) and presentation (UI pages).
- The Helm chart encapsulates the deployment logic (configuration as code) for the entire system.
- It is a microservice-ish design where the UI (client-side) and the API backend are separately deployable components within a managed Kubernetes infrastructure.

##### Relevant Technologies and Frameworks
- Frontend: React, TypeScript, and supporting libraries (e.g., Storybook, ESLint, Prettier) as seen in the file names.
- Backend: The “api” is likely built using Node.js/TypeScript or another backend framework (even if not immediately clear from the file tree, this is common in full-stack JavaScript projects).
- Containerization: Docker (Dockerfiles are provided, e.g., in the web directory).
- Deployment: Kubernetes and Helm for orchestration and deployment.
- Security and Authentication: Keycloak for authentication and Vault for secrets.
- Storage: S3-compatible storage integration.

##### Final Advice
- Detail is key: do not hesitate to break the components further (e.g., represent the internal modularity within the frontend’s use cases and adapters if needed).

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Global Entities
    User["User/Browser"]:::external

    %% Client Layer
    subgraph "Client Layer"
        ONYXIA_WEB["Onyxia Web Frontend"]:::frontend
    end

    %% Server Layer
    subgraph "Server Layer"
        ONYXIA_API["Onyxia API Backend"]:::backend
        K8S["Kubernetes Cluster (Helm Chart Deployments)"]:::infrastructure
    end

    %% External Services
    subgraph "External Services"
        KEYCLOAK["Keycloak"]:::external
        VAULT["Vault"]:::external
        S3["S3 Storage"]:::external
    end

    %% CI/CD Annotation
    CICD["CI/CD (GitHub Actions)"]:::cicd

    %% Connections
    User -->|"interacts"| ONYXIA_WEB
    ONYXIA_WEB <-->|"dataExchange"| ONYXIA_API
    ONYXIA_API -->|"deploys"| K8S
    ONYXIA_API -->|"authenticates"| KEYCLOAK
    ONYXIA_API -->|"managesSecrets"| VAULT
    ONYXIA_API -->|"handlesData"| S3

    %% Click Events
    click ONYXIA_WEB "https://github.com/inseefrlab/onyxia/tree/main/web/"
    click ONYXIA_API "https://github.com/inseefrlab/onyxia/tree/main/api/"
    click K8S "https://github.com/inseefrlab/onyxia/tree/main/helm-chart/"
    click KEYCLOAK "https://github.com/inseefrlab/onyxia/tree/main/web/src/keycloak-theme/"
    click VAULT "https://github.com/inseefrlab/onyxia/tree/main/web/src/core/adapters/secretManager/"
    click S3 "https://github.com/inseefrlab/onyxia/tree/main/web/src/core/adapters/s3Client/"
    click CICD "https://github.com/inseefrlab/onyxia/tree/main/.github/workflows/"

    %% Styles
    classDef frontend fill:#ADD8E6,stroke:#000,stroke-width:1px;
    classDef backend fill:#6495ED,stroke:#000,stroke-width:1px;
    classDef infrastructure fill:#90EE90,stroke:#000,stroke-width:1px;
    classDef external fill:#FFA07A,stroke:#000,stroke-width:1px;
    classDef cicd fill:#D3D3D3,stroke:#000,stroke-width:1px;
```
