# thierrydembaba/greenops architecture

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

- Interactive diagram: https://gitdiagram.com/thierrydembaba/greenops
- Repository: https://github.com/thierrydembaba/greenops

## Overview

GreenOps is a cloud-native energy and carbon monitoring platform. Its main workflow is simulated power metrics scraped by Prometheus and published to RabbitMQ; the calculation service converts them to carbon values, stores them in PostgreSQL, and streams live updates to the dashboard, while the lecture service supplies historical data. Users can also register and sign in, manage alert thresholds, and view observability consoles. The README documents the monitoring and logging stack; those relationships are cited there where source excerpts do not show runtime wiring.

Main entry points: [`frontend/src/App.vue`](https://github.com/thierrydembaba/greenops/blob/main/frontend/src/App.vue) (Vue dashboard), [`service-calcul/main.py`](https://github.com/thierrydembaba/greenops/blob/main/service-calcul/main.py) (Carbon calculation), [`gestion-alerte/main.py`](https://github.com/thierrydembaba/greenops/blob/main/gestion-alerte/main.py) (Alert management), [`k8s/deployment/postgres-deployment.yaml`](https://github.com/thierrydembaba/greenops/blob/main/k8s/deployment/postgres-deployment.yaml) (PostgreSQL)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_frontend["Vue dashboard<br/>[App.vue]"]
  node_gateway["Nginx API gateway<br/>[nginx.conf]"]
  node_ingress["Kubernetes ingress"]
end

subgraph group_telemetry["Telemetry pipeline"]
  node_simulator["Metric simulator<br/>[main.py]"]
  node_rabbitmq["Metrics queue<br/>[rabbitmq.yaml]"]
  node_calculator["Carbon calculation<br/>[main.py]"]
  node_websocket["Live metric broadcast<br/>[main.py]"]
end

subgraph group_domain["Application services"]
  node_postgres[("PostgreSQL")]
  node_reader["Historical data reader<br/>[main.py]"]
  node_auth["Authentication and JWT<br/>[main.py]"]
  node_alerts["Alert management<br/>[main.py]"]
  node_redis[("Redis cache<br/>[redis.yaml]")]
end

subgraph group_observability["Observability"]
  node_prometheus["Prometheus scrape<br/>[prometheus.yml]"]
  node_grafana["Grafana dashboards"]
  node_alertmanager["Alertmanager<br/>[alerts-values.yaml]"]
  node_promtail["Promtail log collection<br/>[promtail.yaml]"]
  node_loki["Loki log storage"]
end

node_user(("Dashboard user"))
node_slack(("Slack notifications"))

node_user -->|"uses"| node_frontend
node_frontend -->|"calls APIs"| node_gateway
node_ingress -->|"routes traffic"| node_frontend
node_ingress -->|"routes APIs"| node_gateway
node_prometheus -->|"scrapes metrics"| node_simulator
node_simulator -->|"publishes metrics"| node_rabbitmq
node_calculator -->|"consumes metrics"| node_rabbitmq
node_calculator -->|"writes metrics"| node_postgres
node_calculator -->|"queues updates"| node_websocket
node_websocket -->|"streams updates"| node_frontend
node_reader -->|"reads history"| node_postgres
node_frontend -->|"fetches history"| node_reader
node_frontend -->|"registers and signs in"| node_auth
node_calculator -->|"verifies JWT"| node_auth
node_frontend -->|"manages alerts"| node_alerts
node_alerts -->|"stores alert records"| node_postgres
node_alerts -.->|"uses cache"| node_redis
node_frontend -->|"opens SSO console"| node_grafana
node_prometheus -->|"dispatches alerts"| node_alertmanager
node_alertmanager -->|"notifies"| node_slack
node_promtail -->|"ships logs"| node_loki

click node_frontend "https://github.com/thierrydembaba/greenops/blob/main/frontend/src/App.vue"
click node_gateway "https://github.com/thierrydembaba/greenops/blob/main/api-gateway/nginx.conf"
click node_ingress "https://github.com/thierrydembaba/greenops/blob/main/k8s/infrastructure/ingress-routing.yaml"
click node_simulator "https://github.com/thierrydembaba/greenops/blob/main/service-simulator/main.py"
click node_prometheus "https://github.com/thierrydembaba/greenops/blob/main/prometheus.yml"
click node_rabbitmq "https://github.com/thierrydembaba/greenops/blob/main/k8s/infrastructure/rabbitmq.yaml"
click node_calculator "https://github.com/thierrydembaba/greenops/blob/main/service-calcul/main.py"
click node_websocket "https://github.com/thierrydembaba/greenops/blob/main/service-calcul/main.py"
click node_postgres "https://github.com/thierrydembaba/greenops/blob/main/k8s/deployment/postgres-deployment.yaml"
click node_reader "https://github.com/thierrydembaba/greenops/blob/main/service-lecture/main.py"
click node_auth "https://github.com/thierrydembaba/greenops/blob/main/service-auth/main.py"
click node_alerts "https://github.com/thierrydembaba/greenops/blob/main/gestion-alerte/main.py"
click node_redis "https://github.com/thierrydembaba/greenops/blob/main/k8s/deployment/redis.yaml"
click node_grafana "https://github.com/thierrydembaba/greenops/blob/main/k8s/deployment/grafana-values.yaml"
click node_alertmanager "https://github.com/thierrydembaba/greenops/blob/main/k8s/infrastructure/alerts-values.yaml"
click node_promtail "https://github.com/thierrydembaba/greenops/blob/main/k8s/logging/promtail.yaml"
click node_loki "https://github.com/thierrydembaba/greenops/blob/main/k8s/logging/loki-deployment.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_frontend,node_gateway,node_ingress,node_user toneBlue
class node_simulator,node_rabbitmq,node_calculator,node_websocket toneAmber
class node_postgres,node_reader,node_auth,node_alerts,node_redis toneMint
class node_prometheus,node_grafana,node_alertmanager,node_promtail,node_loki toneRose
class node_slack toneIndigo
```

## Components

### User experience

- [Vue dashboard](https://github.com/thierrydembaba/greenops/blob/main/frontend/src/App.vue): `frontend/src/App.vue`
- [Nginx API gateway](https://github.com/thierrydembaba/greenops/blob/main/api-gateway/nginx.conf): `api-gateway/nginx.conf`
- [Kubernetes ingress](https://github.com/thierrydembaba/greenops/blob/main/k8s/infrastructure/ingress-routing.yaml): `k8s/infrastructure/ingress-routing.yaml`

### Telemetry pipeline

- [Metric simulator](https://github.com/thierrydembaba/greenops/blob/main/service-simulator/main.py): `service-simulator/main.py`
- [Metrics queue](https://github.com/thierrydembaba/greenops/blob/main/k8s/infrastructure/rabbitmq.yaml): `k8s/infrastructure/rabbitmq.yaml`
- [Carbon calculation](https://github.com/thierrydembaba/greenops/blob/main/service-calcul/main.py): `service-calcul/main.py`
- [Live metric broadcast](https://github.com/thierrydembaba/greenops/blob/main/service-calcul/main.py): `service-calcul/main.py`

### Application services

- [PostgreSQL](https://github.com/thierrydembaba/greenops/blob/main/k8s/deployment/postgres-deployment.yaml): `k8s/deployment/postgres-deployment.yaml`
- [Historical data reader](https://github.com/thierrydembaba/greenops/blob/main/service-lecture/main.py): `service-lecture/main.py`
- [Authentication and JWT](https://github.com/thierrydembaba/greenops/blob/main/service-auth/main.py): `service-auth/main.py`
- [Alert management](https://github.com/thierrydembaba/greenops/blob/main/gestion-alerte/main.py): `gestion-alerte/main.py`
- [Redis cache](https://github.com/thierrydembaba/greenops/blob/main/k8s/deployment/redis.yaml): `k8s/deployment/redis.yaml`

### Observability

- [Prometheus scrape](https://github.com/thierrydembaba/greenops/blob/main/prometheus.yml): `prometheus.yml`
- [Grafana dashboards](https://github.com/thierrydembaba/greenops/blob/main/k8s/deployment/grafana-values.yaml): `k8s/deployment/grafana-values.yaml`
- [Alertmanager](https://github.com/thierrydembaba/greenops/blob/main/k8s/infrastructure/alerts-values.yaml): `k8s/infrastructure/alerts-values.yaml`
- [Promtail log collection](https://github.com/thierrydembaba/greenops/blob/main/k8s/logging/promtail.yaml): `k8s/logging/promtail.yaml`
- [Loki log storage](https://github.com/thierrydembaba/greenops/blob/main/k8s/logging/loki-deployment.yaml): `k8s/logging/loki-deployment.yaml`

### Other components

- **Dashboard user**
- **Slack notifications**

## Connections

- Dashboard user → Vue dashboard: uses (evidence: `readme.md`)
- Vue dashboard → Nginx API gateway: calls APIs (evidence: `frontend/src/App.vue`)
- Kubernetes ingress → Vue dashboard: routes traffic (evidence: `readme.md`)
- Kubernetes ingress → Nginx API gateway: routes APIs (evidence: `readme.md`)
- Prometheus scrape → Metric simulator: scrapes metrics (evidence: `readme.md`)
- Metric simulator → Metrics queue: publishes metrics (evidence: `service-simulator/main.py`)
- Carbon calculation → Metrics queue: consumes metrics (evidence: `service-calcul/main.py`)
- Carbon calculation → PostgreSQL: writes metrics (evidence: `service-calcul/main.py`)
- Carbon calculation → Live metric broadcast: queues updates (evidence: `service-calcul/main.py`)
- Live metric broadcast → Vue dashboard: streams updates (evidence: `readme.md`)
- Historical data reader → PostgreSQL: reads history (evidence: `service-lecture/main.py`)
- Vue dashboard → Historical data reader: fetches history (evidence: `frontend/src/App.vue`)
- Vue dashboard → Authentication and JWT: registers and signs in (evidence: `frontend/src/App.vue`)
- Carbon calculation → Authentication and JWT: verifies JWT (evidence: `service-calcul/main.py`)
- Vue dashboard → Alert management: manages alerts (evidence: `readme.md`)
- Alert management → PostgreSQL: stores alert records (evidence: `gestion-alerte/main.py`)
- Alert management → Redis cache: uses cache (evidence: `readme.md`)
- Vue dashboard → Grafana dashboards: opens SSO console (evidence: `readme.md`)
- Prometheus scrape → Alertmanager: dispatches alerts (evidence: `readme.md`)
- Alertmanager → Slack notifications: notifies (evidence: `readme.md`)
- Promtail log collection → Loki log storage: ships logs (evidence: `readme.md`)
