# makhatib/litellm-openwebui architecture

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

- Interactive diagram: https://gitdiagram.com/makhatib/litellm-openwebui
- Repository: https://github.com/makhatib/litellm-openwebui

## Overview

##### Project type and purpose
- This is a Bash automation script (litellm_openWebUI.sh) whose sole purpose is to install, configure, and launch two Dockerized applications (litellm and open-webui).
- There is no custom application code here, only orchestration of external components (git repos, Docker engine).

##### File structure
- Top-level files:
- README.md – describes the script’s behavior
- litellm_openWebUI.sh – the automation script
- No additional source directories; all logic is in the script.

##### README for additional insights
- The script:
- Checks for prerequisites (git, docker, docker-compose)
- Clones or updates two repos: litellm and open-webui
- Prompts for secret keys and writes a .env file for litellm
- Runs docker-compose up for litellm
- Runs a docker run command for open-webui (with user-provided volume mount and host port)
- Displays container URLs and running containers.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% User and Documentation
    User["User (Operator)"]:::external
    Readme["README.md"]:::repo
    User -->|reads| Readme

    %% Automation Script
    User -->|runs| Script["litellm_openWebUI.sh"]:::script
    click Script "https://github.com/makhatib/litellm-openwebui/blob/main/litellm_openWebUI.sh"
    click Readme "https://github.com/makhatib/litellm-openwebui/blob/main/README.md"

    %% External Tools
    subgraph "External Tools"
        Git["git CLI"]:::external
        Docker["Docker Engine"]:::external
        Compose["docker-compose"]:::external
    end

    %% Local Repositories
    subgraph "Local Repositories"
        LitellmRepo["litellm repo"]:::repo
        OpenWebUIRepo["open-webui repo"]:::repo
    end

    %% Configuration
    SecretPrompt{"Prompt for LITELLM_MASTER_KEY & SALT_KEY"}:::decision
    Env[".env"]:::config
    click Env "https://github.com/makhatib/litellm-openwebui/blob/main/.env"

    %% Containers and Host Network
    LitellmContainer["litellm container\n(ENV: keys)"]:::container
    OpenWebUIContainer["open-webui container"]:::container
    HostNetwork["Host Network\nIP & Ports\n4000, user_port"]:::network

    %% Script Workflow
    Script -->|check prerequisites| Git
    Script -->|check prerequisites| Docker
    Script -->|check prerequisites| Compose
    Script -->|clone/pull repos| Git
    Git -->|clones/updates| LitellmRepo
    Git -->|clones/updates| OpenWebUIRepo
    Script -->|prompt secrets| SecretPrompt
    SecretPrompt -->|writes| Env
    Script -->|"docker-compose up -d"| Compose
    Compose -->|creates| LitellmContainer
    Script -->|"docker run -v host_path:container_path -p host_port:container_port"| Docker
    Docker -->|runs| OpenWebUIContainer
    Script -->|retrieve host IP| HostNetwork
    Script -->|docker ps| HostNetwork

    %% Connections to Host Network
    LitellmContainer --> HostNetwork
    OpenWebUIContainer --> HostNetwork

    %% Styles
    classDef script fill:#cce5ff,stroke:#3399ff
    classDef external fill:#ffe0b3,stroke:#ff9900
    classDef repo fill:#f2f2f2,stroke:#999999
    classDef config fill:#d9d9d9,stroke:#666666
    classDef container fill:#d0f0c0,stroke:#339933
    classDef network fill:#e0ccff,stroke:#9933ff
    classDef decision fill:#ffffff,stroke:#000000,stroke-dasharray:5 5
```
