# vladimirvuletic002/diplomski architecture

> Architecture diagram of the GitHub repository vladimirvuletic002/diplomski, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-06). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/vladimirvuletic002/diplomski
- Repository: https://github.com/vladimirvuletic002/diplomski

## Overview

This is a Kubernetes-hosted microservice demo for metric-driven canary releases and automated rollback. The user-facing workflow is dashboard/API request → gateway → aggregation → simulated meter readings, with version identity and consumption totals returned through the chain. Separate platform branches handle traffic weighting, Prometheus-based rollout analysis, GitOps delivery, and optional backup/restore. Service request and aggregation behavior is supported by sampled Go source; deployment and operations relationships are based on the README, so unsampled platform internals are represented at their manifest paths.

Main entry points: [`services/gateway/handlers.go`](https://github.com/vladimirvuletic002/diplomski/blob/main/services/gateway/handlers.go) (Gateway API), [`k8s/monitoring/values.yaml`](https://github.com/vladimirvuletic002/diplomski/blob/main/k8s/monitoring/values.yaml) (Prometheus), [`services/aggregation-service/handlers.go`](https://github.com/vladimirvuletic002/diplomski/blob/main/services/aggregation-service/handlers.go) (Aggregation API), [`k8s/base/aggregation-service.yaml`](https://github.com/vladimirvuletic002/diplomski/blob/main/k8s/base/aggregation-service.yaml) (Argo Rollouts)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User Experience"]
  node_traefik["Traefik Entry<br/>[gateway.yaml]"]
  node_gateway["Gateway API<br/>[handlers.go]"]
  node_dashboard["Dashboard UI<br/>[main.go]"]
  node_gateway_client["Aggregation Client<br/>[client.go]"]
end

subgraph group_services["Energy Services"]
  node_aggregation["Aggregation API<br/>[handlers.go]"]
  node_metering["Meter Readings<br/>[handlers.go]"]
  node_metering_client["Metering Client<br/>[client.go]"]
end

subgraph group_observability["Rollout Analysis"]
  node_gateway_metrics["Gateway Metrics<br/>[metrics.go]"]
  node_aggregation_metrics["Aggregation Metrics<br/>[metrics.go]"]
  node_metering_metrics["Metering Metrics<br/>[metrics.go]"]
  node_prometheus[("Prometheus<br/>[values.yaml]")]
  node_analysis["Canary Analysis"]
end

subgraph group_delivery["Release Platform"]
  node_rollouts["Argo Rollouts"]
  node_argocd["Argo CD Sync<br/>[application.yaml]"]
  node_manifests["Service Manifests"]
  node_github["GitHub Actions<br/>[release.yml]"]
  node_registry[("GHCR")]
end

subgraph group_recovery["Backup Recovery"]
  node_velero["Velero Backup<br/>[minio.yaml]"]
  node_minio[("MinIO Storage<br/>[minio.yaml]")]
end

node_user(("Dashboard User"))

node_user -->|"requests"| node_traefik
node_traefik -->|"routes traffic"| node_gateway
node_gateway -->|"serves page"| node_dashboard
node_user -->|"requests summary"| node_gateway
node_gateway -->|"fetches summary"| node_gateway_client
node_gateway_client -->|"requests aggregate"| node_aggregation
node_aggregation -->|"fetches readings"| node_metering_client
node_metering_client -->|"requests readings"| node_metering
node_gateway -->|"records requests"| node_gateway_metrics
node_aggregation -->|"records requests"| node_aggregation_metrics
node_metering -->|"records requests"| node_metering_metrics
node_gateway_metrics -->|"exposes metrics"| node_prometheus
node_aggregation_metrics -->|"exposes metrics"| node_prometheus
node_metering_metrics -->|"exposes metrics"| node_prometheus
node_prometheus -->|"supplies metrics"| node_analysis
node_analysis -->|"judges canary"| node_rollouts
node_rollouts -->|"promotes or rolls back"| node_manifests
node_github -->|"pushes images"| node_registry
node_github -->|"commits version bump"| node_manifests
node_argocd -->|"reconciles Git"| node_manifests
node_registry -.->|"provides release image"| node_rollouts
node_velero -->|"stores backups"| node_minio

click node_traefik "https://github.com/vladimirvuletic002/diplomski/blob/main/k8s/base/gateway.yaml"
click node_gateway "https://github.com/vladimirvuletic002/diplomski/blob/main/services/gateway/handlers.go"
click node_dashboard "https://github.com/vladimirvuletic002/diplomski/blob/main/services/gateway/main.go"
click node_aggregation "https://github.com/vladimirvuletic002/diplomski/blob/main/services/aggregation-service/handlers.go"
click node_metering "https://github.com/vladimirvuletic002/diplomski/blob/main/services/metering-service/handlers.go"
click node_gateway_client "https://github.com/vladimirvuletic002/diplomski/blob/main/services/gateway/client.go"
click node_metering_client "https://github.com/vladimirvuletic002/diplomski/blob/main/services/aggregation-service/client.go"
click node_gateway_metrics "https://github.com/vladimirvuletic002/diplomski/blob/main/services/gateway/metrics.go"
click node_aggregation_metrics "https://github.com/vladimirvuletic002/diplomski/blob/main/services/aggregation-service/metrics.go"
click node_metering_metrics "https://github.com/vladimirvuletic002/diplomski/blob/main/services/metering-service/metrics.go"
click node_prometheus "https://github.com/vladimirvuletic002/diplomski/blob/main/k8s/monitoring/values.yaml"
click node_analysis "https://github.com/vladimirvuletic002/diplomski/blob/main/k8s/base/analysis-template.yaml"
click node_rollouts "https://github.com/vladimirvuletic002/diplomski/blob/main/k8s/base/aggregation-service.yaml"
click node_argocd "https://github.com/vladimirvuletic002/diplomski/blob/main/k8s/argocd/application.yaml"
click node_manifests "https://github.com/vladimirvuletic002/diplomski/tree/main/k8s/base"
click node_github "https://github.com/vladimirvuletic002/diplomski/blob/main/.github/workflows/release.yml"
click node_velero "https://github.com/vladimirvuletic002/diplomski/blob/main/k8s/velero/minio.yaml"
click node_minio "https://github.com/vladimirvuletic002/diplomski/blob/main/k8s/velero/minio.yaml"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_traefik,node_gateway,node_dashboard,node_gateway_client,node_user toneBlue
class node_aggregation,node_metering,node_metering_client toneAmber
class node_gateway_metrics,node_aggregation_metrics,node_metering_metrics,node_prometheus,node_analysis toneMint
class node_rollouts,node_argocd,node_manifests,node_github,node_registry toneRose
class node_velero,node_minio toneIndigo
```

## Components

### User Experience

- [Traefik Entry](https://github.com/vladimirvuletic002/diplomski/blob/main/k8s/base/gateway.yaml): `k8s/base/gateway.yaml`
- [Gateway API](https://github.com/vladimirvuletic002/diplomski/blob/main/services/gateway/handlers.go): `services/gateway/handlers.go`
- [Dashboard UI](https://github.com/vladimirvuletic002/diplomski/blob/main/services/gateway/main.go): `services/gateway/main.go`
- [Aggregation Client](https://github.com/vladimirvuletic002/diplomski/blob/main/services/gateway/client.go): `services/gateway/client.go`

### Energy Services

- [Aggregation API](https://github.com/vladimirvuletic002/diplomski/blob/main/services/aggregation-service/handlers.go): `services/aggregation-service/handlers.go`
- [Meter Readings](https://github.com/vladimirvuletic002/diplomski/blob/main/services/metering-service/handlers.go): `services/metering-service/handlers.go`
- [Metering Client](https://github.com/vladimirvuletic002/diplomski/blob/main/services/aggregation-service/client.go): `services/aggregation-service/client.go`

### Rollout Analysis

- [Gateway Metrics](https://github.com/vladimirvuletic002/diplomski/blob/main/services/gateway/metrics.go): `services/gateway/metrics.go`
- [Aggregation Metrics](https://github.com/vladimirvuletic002/diplomski/blob/main/services/aggregation-service/metrics.go): `services/aggregation-service/metrics.go`
- [Metering Metrics](https://github.com/vladimirvuletic002/diplomski/blob/main/services/metering-service/metrics.go): `services/metering-service/metrics.go`
- [Prometheus](https://github.com/vladimirvuletic002/diplomski/blob/main/k8s/monitoring/values.yaml): `k8s/monitoring/values.yaml`
- [Canary Analysis](https://github.com/vladimirvuletic002/diplomski/blob/main/k8s/base/analysis-template.yaml): `k8s/base/analysis-template.yaml`

### Release Platform

- [Argo Rollouts](https://github.com/vladimirvuletic002/diplomski/blob/main/k8s/base/aggregation-service.yaml): `k8s/base/aggregation-service.yaml`
- [Argo CD Sync](https://github.com/vladimirvuletic002/diplomski/blob/main/k8s/argocd/application.yaml): `k8s/argocd/application.yaml`
- [Service Manifests](https://github.com/vladimirvuletic002/diplomski/tree/main/k8s/base): `k8s/base`
- [GitHub Actions](https://github.com/vladimirvuletic002/diplomski/blob/main/.github/workflows/release.yml): `.github/workflows/release.yml`
- **GHCR**

### Backup Recovery

- [Velero Backup](https://github.com/vladimirvuletic002/diplomski/blob/main/k8s/velero/minio.yaml): `k8s/velero/minio.yaml`
- [MinIO Storage](https://github.com/vladimirvuletic002/diplomski/blob/main/k8s/velero/minio.yaml): `k8s/velero/minio.yaml`

### Other components

- **Dashboard User**

## Connections

- Dashboard User → Traefik Entry: requests (evidence: `README.md`)
- Traefik Entry → Gateway API: routes traffic (evidence: `README.md`)
- Gateway API → Dashboard UI: serves page (evidence: `services/gateway/main.go`)
- Dashboard User → Gateway API: requests summary (evidence: `README.md`)
- Gateway API → Aggregation Client: fetches summary (evidence: `services/gateway/handlers.go`)
- Aggregation Client → Aggregation API: requests aggregate (evidence: `services/gateway/client.go`)
- Aggregation API → Metering Client: fetches readings (evidence: `services/aggregation-service/handlers.go`)
- Metering Client → Meter Readings: requests readings (evidence: `services/aggregation-service/client.go`)
- Gateway API → Gateway Metrics: records requests
- Aggregation API → Aggregation Metrics: records requests
- Meter Readings → Metering Metrics: records requests
- Gateway Metrics → Prometheus: exposes metrics (evidence: `README.md`)
- Aggregation Metrics → Prometheus: exposes metrics (evidence: `README.md`)
- Metering Metrics → Prometheus: exposes metrics (evidence: `README.md`)
- Prometheus → Canary Analysis: supplies metrics (evidence: `README.md`)
- Canary Analysis → Argo Rollouts: judges canary (evidence: `README.md`)
- Argo Rollouts → Service Manifests: promotes or rolls back (evidence: `README.md`)
- GitHub Actions → GHCR: pushes images (evidence: `README.md`)
- GitHub Actions → Service Manifests: commits version bump (evidence: `README.md`)
- Argo CD Sync → Service Manifests: reconciles Git (evidence: `README.md`)
- GHCR → Argo Rollouts: provides release image (evidence: `README.md`)
- Velero Backup → MinIO Storage: stores backups (evidence: `README.md`)
