# stclab-inc/wave-autoscale architecture

> Architecture diagram of the GitHub repository stclab-inc/wave-autoscale, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-01-20). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/stclab-inc/wave-autoscale
- Repository: https://github.com/stclab-inc/wave-autoscale

## Overview

##### Main Components Identification

a) Core Services:
- API Server (core/api-server)
- Data Layer (core/data-layer)
- Web Application (core/web-app)
- Wave Autoscale Engine (core/wave-autoscale)

b) External Integrations:
- Cloud Providers (AWS, Azure, Google Cloud)
- Kubernetes Clusters
- Monitoring Systems (Prometheus, CloudWatch, etc.)

**┌─ User Interface Layer ─────────────────────┐**
- Web Application (Next.js)                │
- Dashboard & Configuration UI             │
- API Layer ──────────────────────────────┐ │
- REST API Server                        │ │
- Metrics API                            │ │
- Core Processing Layer ──────────────────┤ │
- Scaling Planner                        │ │
- Metric Collector Manager               │ │
- Scaling Component Manager              │ │
- Data Layer ───────────────────────────┐ │ │
- Metrics Storage                      │ │ │
- Configuration Storage                │ │ │
- Plan Logs                           │ │ │
- ┴─┴─┘

##### Component Relationships

- Data flow (→): Metrics collection, scaling commands
- Dependencies (⇢): Service dependencies
- Integration points (⇆): External service connections

**[Web UI] ←→ [API Server] ←→ [Wave Autoscale Engine]**
- ↑               ↑
- ↓               ↓
- [Data Layer] ←→ [Metric Collector]

##### Additional Details

Annotations for:
- Authentication flows
- Metric collection paths
- Scaling decision processes
- Configuration management
- Log collection and storage

##### Implementation Notes

- Use standardized symbols for cloud services
- Both control and data planes
- Scaling decision paths
- Monitoring points

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef ui fill:#2196F3,stroke:#1565C0,color:white
    classDef api fill:#4CAF50,stroke:#2E7D32,color:white
    classDef core fill:#FF5722,stroke:#D84315,color:white
    classDef data fill:#9C27B0,stroke:#6A1B9A,color:white
    classDef external fill:#607D8B,stroke:#455A64,color:white
    classDef monitoring fill:#FFC107,stroke:#FFA000,color:black
    
    subgraph "User Interface Layer"
        WebUI["Web Application\n(Next.js)"]:::ui
    end

    subgraph "API Layer"
        APIServer["API Server"]:::api
        MetricsAPI["Metrics API"]:::api
    end

    subgraph "Core Processing Layer"
        WaveEngine["Wave Autoscale Engine"]:::core
        ScalingPlanner["Scaling Planner"]:::core
        MetricCollector["Metric Collector Manager"]:::core
        ScalingManager["Scaling Component Manager"]:::core
    end

    subgraph "Data Layer"
        MetricsStorage["Metrics Storage"]:::data
        ConfigStorage["Configuration Storage"]:::data
        PlanLogs["Plan Logs"]:::data
    end

    subgraph "External Services"
        direction TB
        subgraph "Cloud Providers"
            AWS["AWS Services"]:::external
            Azure["Azure Services"]:::external
            GCP["Google Cloud"]:::external
        end
        
        subgraph "Monitoring Systems"
            Prometheus["Prometheus"]:::monitoring
            CloudWatch["CloudWatch"]:::monitoring
            GCMonitoring["Google Cloud\nMonitoring"]:::monitoring
        end
        
        Kubernetes["Kubernetes\nClusters"]:::external
    end

    %% Relationships
    WebUI --> APIServer
    APIServer --> MetricsAPI
    APIServer --> WaveEngine
    WaveEngine --> ScalingPlanner
    WaveEngine --> MetricCollector
    WaveEngine --> ScalingManager
    
    MetricCollector --> MetricsStorage
    ScalingPlanner --> ConfigStorage
    ScalingManager --> PlanLogs
    
    MetricCollector --> Prometheus
    MetricCollector --> CloudWatch
    MetricCollector --> GCMonitoring
    
    ScalingManager --> AWS
    ScalingManager --> Azure
    ScalingManager --> GCP
    ScalingManager --> Kubernetes

    %% Click Events
    click WebUI "https://github.com/STCLab-Inc/wave-autoscale/tree/main/core/web-app/"
    click APIServer "https://github.com/STCLab-Inc/wave-autoscale/tree/main/core/api-server/"
    click WaveEngine "https://github.com/STCLab-Inc/wave-autoscale/tree/main/core/wave-autoscale/"
    click ScalingPlanner "https://github.com/STCLab-Inc/wave-autoscale/tree/main/core/wave-autoscale/src/scaling_planner/"
    click MetricCollector "https://github.com/STCLab-Inc/wave-autoscale/tree/main/core/wave-autoscale/src/metric_collector_manager/"
    click ScalingManager "https://github.com/STCLab-Inc/wave-autoscale/tree/main/core/wave-autoscale/src/scaling_component/"
    click MetricsStorage "https://github.com/STCLab-Inc/wave-autoscale/blob/main/core/data-layer/src/data_layer/metrics_data.rs"
    click ConfigStorage "https://github.com/STCLab-Inc/wave-autoscale/blob/main/core/data-layer/src/data_layer/scaling_plan.rs"

    %% Legend
    subgraph Legend
        UI["UI Components"]:::ui
        APIComp["API Components"]:::api
        CoreComp["Core Components"]:::core
        DataComp["Data Components"]:::data
        ExtComp["External Services"]:::external
        MonComp["Monitoring Systems"]:::monitoring
    end
```
