# janikmiet/docker_sleeprevolution architecture

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

- Interactive diagram: https://gitdiagram.com/janikmiet/docker_sleeprevolution
- Repository: https://github.com/janikmiet/docker_sleeprevolution

## Overview

##### Main Components

a) Client Layer:
- Web Browser interface
- Caddy Web Server (reverse proxy/load balancer)

b) Application Layer (3 Shiny Applications):
- Sleep Apnea Cost Visualizer
- Sleep Apnea Calculator
- Sleep Apnea Predictor

c) Container Infrastructure:
- Docker environment
- Docker Compose orchestration

**[Client Tier]**

**[Service Tier]**

**[Container Tier]**

##### Specific Component Relationships

- How the Caddy webserver routes requests to the three Shiny applications
- The containerization of each component
- The Docker Compose orchestration layer

##### Key Elements to Highlight

a) Entry Points:
- HTTP/HTTPS traffic entering through Caddy
- Port mappings from host to containers

b) Application Components:
- Each Shiny application as a separate container
- Inter-container communication if any exists

c) Infrastructure:
- Docker Compose orchestration
- Network isolation between containers

- [Web Browser] → [Caddy Webserver]

##### Service routing layer
- [Caddy Webserver]
- ↙     ↓     ↘
- [Visualizer] [Calculator] [Predictor]

##### Container infrastructure
- [Docker Compose]

- [Visualizer Container]
- [Calculator Container]
- [Predictor Container]

##### Additional Details

Annotations for:
- Docker image references (from Docker Hub)
- Port mappings
- Volume mounts if present
- Network configurations

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client
        Browser["Web Browser"]
        WebUI["Web Interface"]:::webui
        click WebUI "https://github.com/janikmiet/docker_sleeprevolution/blob/main/site/index.html"
        CSS["Styling"]:::css
        click CSS "https://github.com/janikmiet/docker_sleeprevolution/blob/main/site/styles.css"
        JS["Client Scripts"]:::js
        click JS "https://github.com/janikmiet/docker_sleeprevolution/blob/main/site/apps.js"
    end

    subgraph "Web Server"
        Caddy["Caddy Server"]:::proxy
        click Caddy "https://github.com/janikmiet/docker_sleeprevolution/tree/main/Caddyfile"
    end

    subgraph "Application Layer"
        Calc["Sleep Apnea Calculator"]:::app
        click Calc "https://github.com/janikmiet/docker_sleeprevolution/blob/main/site/docs/calculate-costs.html"
        Vis["Sleep Apnea Visualizer"]:::app
        click Vis "https://github.com/janikmiet/docker_sleeprevolution/blob/main/site/docs/visualizing.html"
        Pred["Sleep Apnea Predictor"]:::app
    end

    subgraph "Documentation"
        AppDocs["Application Documentation"]:::docs
        click AppDocs "https://github.com/janikmiet/docker_sleeprevolution/blob/main/site/docs/interactive-applications.html"
        VisDoc["Visualization Guide"]:::docs
        click VisDoc "https://github.com/janikmiet/docker_sleeprevolution/blob/main/site/docs/interactive-visualizations.html"
        Assets["Documentation Assets"]:::docs
        click Assets "https://github.com/janikmiet/docker_sleeprevolution/tree/main/site/docs/book_assets/"
    end

    subgraph "Infrastructure"
        Docker["Docker Compose"]:::infra
        click Docker "https://github.com/janikmiet/docker_sleeprevolution/blob/main/docker-compose.yml"
    end

    Browser --> WebUI
    WebUI --> CSS
    WebUI --> JS
    WebUI --> Caddy
    Caddy --> Calc
    Caddy --> Vis
    Caddy --> Pred
    Docker --> Calc
    Docker --> Vis
    Docker --> Pred
    WebUI --> AppDocs
    AppDocs --> VisDoc
    AppDocs --> Assets

    classDef webui fill:#e1f5fe,stroke:#01579b
    classDef css fill:#e8f5e9,stroke:#1b5e20
    classDef js fill:#fff3e0,stroke:#e65100
    classDef proxy fill:#90caf9,stroke:#1976d2
    classDef app fill:#a5d6a7,stroke:#388e3c
    classDef docs fill:#fff9c4,stroke:#f57f17
    classDef infra fill:#cfd8dc,stroke:#455a64

    %% Legend
    subgraph Legend
        L1["Web Interface"]:::webui
        L2["Styling"]:::css
        L3["Scripts"]:::js
        L4["Proxy"]:::proxy
        L5["Applications"]:::app
        L6["Documentation"]:::docs
        L7["Infrastructure"]:::infra
    end
```
