# qorgh529/homelab-k8s architecture

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

- Interactive diagram: https://gitdiagram.com/qorgh529/homelab-k8s
- Repository: https://github.com/qorgh529/homelab-k8s

## Overview

This repository is a Kubernetes-hosted internal web portal with a FastAPI backend, PostgreSQL storage, and operational monitoring and alerting. The main user workflow is accessing the portal through HTTPS, authenticating, and using portal and administrator features backed by the API and database. The README also documents a separate hub homepage and GitOps-managed services, though this tree has no hub implementation files. Relationships for unsampled frontend and deployment wiring are included only where the README documents them.

Main entry points: [`backend/main.py`](https://github.com/qorgh529/homelab-k8s/blob/main/backend/main.py) (Portal API), [`backend/notifier.py`](https://github.com/qorgh529/homelab-k8s/blob/main/backend/notifier.py) (Alert dispatch), [`frontend/index.html`](https://github.com/qorgh529/homelab-k8s/blob/main/frontend/index.html) (Portal frontend), [`backend/monitor.py`](https://github.com/qorgh529/homelab-k8s/blob/main/backend/monitor.py) (Health checks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_portal["Portal experience"]
  node_frontend["Portal frontend<br/>[index.html]"]
  node_hub["Service hub"]
end

subgraph group_api["Portal API"]
  node_api_main["Portal API<br/>[main.py]"]
  node_auth["Authentication<br/>[main.py]"]
  node_admin["Admin features<br/>[main.py]"]
  node_boards["Boards and notices<br/>[main.py]"]
  node_postgres[("Portal database<br/>[02-postgres.yaml]")]
end

subgraph group_ops["Monitoring and alerts"]
  node_monitor["Health checks<br/>[monitor.py]"]
  node_notifier["Alert dispatch<br/>[notifier.py]"]
end

subgraph group_platform["Cluster platform"]
  node_k8s["Kubernetes workloads<br/>[04-backend.yaml]"]
  node_ingress["HTTPS routing<br/>[08-ingress.yaml]"]
  node_certmanager["Certificate management"]
  node_gitea["Gitea"]
  node_argocd["Argo CD<br/>[06-argocd-app.yaml]"]
end

node_user(("Portal user"))
node_k8s_api["Kubernetes API"]
node_discord["Discord"]
node_gmail["Gmail"]
node_developer(("Developer"))

node_user -->|"opens HTTPS"| node_ingress
node_ingress -->|"routes requests"| node_frontend
node_frontend -->|"calls API"| node_api_main
node_frontend -->|"opens homepage"| node_hub
node_api_main -->|"handles login"| node_auth
node_api_main -->|"handles admin"| node_admin
node_api_main -->|"handles posts"| node_boards
node_api_main -->|"reads and writes"| node_postgres
node_k8s -->|"runs API"| node_api_main
node_k8s -->|"runs frontend"| node_frontend
node_monitor -->|"checks cluster"| node_k8s_api
node_monitor -->|"checks certificates"| node_certmanager
node_monitor -->|"sends alerts"| node_notifier
node_notifier -->|"loads channels"| node_postgres
node_notifier -->|"sends webhook"| node_discord
node_notifier -->|"sends email"| node_gmail
node_developer -->|"pushes changes"| node_gitea
node_gitea -->|"triggers deploy"| node_argocd
node_argocd -->|"deploys workloads"| node_k8s

click node_frontend "https://github.com/qorgh529/homelab-k8s/blob/main/frontend/index.html"
click node_api_main "https://github.com/qorgh529/homelab-k8s/blob/main/backend/main.py"
click node_auth "https://github.com/qorgh529/homelab-k8s/blob/main/backend/main.py"
click node_admin "https://github.com/qorgh529/homelab-k8s/blob/main/backend/main.py"
click node_boards "https://github.com/qorgh529/homelab-k8s/blob/main/backend/main.py"
click node_postgres "https://github.com/qorgh529/homelab-k8s/blob/main/k8s/02-postgres.yaml"
click node_monitor "https://github.com/qorgh529/homelab-k8s/blob/main/backend/monitor.py"
click node_notifier "https://github.com/qorgh529/homelab-k8s/blob/main/backend/notifier.py"
click node_k8s "https://github.com/qorgh529/homelab-k8s/blob/main/k8s/04-backend.yaml"
click node_ingress "https://github.com/qorgh529/homelab-k8s/blob/main/k8s/08-ingress.yaml"
click node_certmanager "https://github.com/qorgh529/homelab-k8s/blob/main/k8s/07-clusterissuer.yaml"
click node_gitea "https://github.com/qorgh529/homelab-k8s/blob/main/09-ingress-gitea.yaml"
click node_argocd "https://github.com/qorgh529/homelab-k8s/blob/main/06-argocd-app.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_hub,node_user toneBlue
class node_api_main,node_auth,node_admin,node_boards,node_postgres toneAmber
class node_monitor,node_notifier,node_k8s_api toneMint
class node_k8s,node_ingress,node_certmanager,node_gitea,node_argocd toneRose
class node_discord,node_gmail,node_developer toneIndigo
```

## Components

### Portal experience

- [Portal frontend](https://github.com/qorgh529/homelab-k8s/blob/main/frontend/index.html): `frontend/index.html`
- **Service hub**

### Portal API

- [Portal API](https://github.com/qorgh529/homelab-k8s/blob/main/backend/main.py): `backend/main.py`
- [Authentication](https://github.com/qorgh529/homelab-k8s/blob/main/backend/main.py): `backend/main.py`
- [Admin features](https://github.com/qorgh529/homelab-k8s/blob/main/backend/main.py): `backend/main.py`
- [Boards and notices](https://github.com/qorgh529/homelab-k8s/blob/main/backend/main.py): `backend/main.py`
- [Portal database](https://github.com/qorgh529/homelab-k8s/blob/main/k8s/02-postgres.yaml): `k8s/02-postgres.yaml`

### Monitoring and alerts

- [Health checks](https://github.com/qorgh529/homelab-k8s/blob/main/backend/monitor.py): `backend/monitor.py`
- [Alert dispatch](https://github.com/qorgh529/homelab-k8s/blob/main/backend/notifier.py): `backend/notifier.py`

### Cluster platform

- [Kubernetes workloads](https://github.com/qorgh529/homelab-k8s/blob/main/k8s/04-backend.yaml): `k8s/04-backend.yaml`
- [HTTPS routing](https://github.com/qorgh529/homelab-k8s/blob/main/k8s/08-ingress.yaml): `k8s/08-ingress.yaml`
- [Certificate management](https://github.com/qorgh529/homelab-k8s/blob/main/k8s/07-clusterissuer.yaml): `k8s/07-clusterissuer.yaml`
- [Gitea](https://github.com/qorgh529/homelab-k8s/blob/main/09-ingress-gitea.yaml): `09-ingress-gitea.yaml`
- [Argo CD](https://github.com/qorgh529/homelab-k8s/blob/main/06-argocd-app.yaml): `06-argocd-app.yaml`

### Other components

- **Portal user**
- **Kubernetes API**
- **Discord**
- **Gmail**
- **Developer**

## Connections

- Portal user → HTTPS routing: opens HTTPS (evidence: `README.md`)
- HTTPS routing → Portal frontend: routes requests (evidence: `README.md`)
- Portal frontend → Portal API: calls API (evidence: `README.md`)
- Portal frontend → Service hub: opens homepage (evidence: `README.md`)
- Portal API → Authentication: handles login (evidence: `backend/main.py`)
- Portal API → Admin features: handles admin (evidence: `backend/main.py`)
- Portal API → Boards and notices: handles posts (evidence: `backend/main.py`)
- Portal API → Portal database: reads and writes (evidence: `backend/main.py`)
- Kubernetes workloads → Portal API: runs API (evidence: `README.md`)
- Kubernetes workloads → Portal frontend: runs frontend (evidence: `README.md`)
- Health checks → Kubernetes API: checks cluster (evidence: `backend/monitor.py`)
- Health checks → Certificate management: checks certificates (evidence: `backend/monitor.py`)
- Health checks → Alert dispatch: sends alerts (evidence: `backend/monitor.py`)
- Alert dispatch → Portal database: loads channels (evidence: `backend/notifier.py`)
- Alert dispatch → Discord: sends webhook (evidence: `backend/notifier.py`)
- Alert dispatch → Gmail: sends email (evidence: `backend/notifier.py`)
- Developer → Gitea: pushes changes (evidence: `README.md`)
- Gitea → Argo CD: triggers deploy (evidence: `README.md`)
- Argo CD → Kubernetes workloads: deploys workloads (evidence: `README.md`)
