# chaitanya2692/my-homelab architecture

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

- Interactive diagram: https://gitdiagram.com/chaitanya2692/my-homelab
- Repository: https://github.com/chaitanya2692/my-homelab

## Overview

##### Project type and purpose
- This is a Kubernetes-based Homelab HTPC (Home Theater PC) system running on k3s.
- It follows a microservices architecture, deploying multiple media-management, download, streaming and utility apps into separate namespaces.
- GitOps and CI/CD play a central role: ArgoCD and GitHub Actions manage deployment and manifest generation.

##### File structure
- Top-level:
- .github/workflows – CI definitions (push.yml, merge.yml)
- argocd/     – GitOps application definitions
- base/       – Kustomize “base” manifests for htpc, infra, utils namespaces
- overlays/   – environment-specific overlays (staging, production)
- scripts/    – helper scripts (bootstrap, validate, deploy, nuke, update-manifests)
- Within base/: three namespaces:
- htpc/   – Sonarr, Radarr, Transmission, Prowlarr, FlareSolverr, Jellyfin
- infra/  – Traefik, cert-manager, MetalLB, storage (LocalPathProvisioner)
- utils/  – Dashy, Nextcloud, Immich, Tandoor
- Kustomization.yaml files tie these into composable overlays.
- argocd/app contains the ArgoCD Application CRDs to point at these bases/overlays.

##### Key architecture details from README
- Networking & Ingress: MetalLB (L2 LoadBalancer), Traefik IngressController (IngressRoute CRDs), HTTP→HTTPS, custom middleware.
- Certificate management: cert-manager with Cloudflare DNS-01 for wildcard TLS.
- Storage: host-path PVs + PVCs (htpc-pvc, infra-pvc, utils-pvc) backing media, infra, utility data.
- Workflows: Sonarr/Radarr → Jackett → Transmission → post-processing → Jellyfin.
- CI/CD: GitHub Actions runs yamllint, kubeconform, kustomize; merge pipeline updates install.yaml; ArgoCD syncs cluster.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External Clients and DNS
    subgraph "External"
        direction TB
        Clients("User Browsers"):::external
        DNS("Cloudflare DNS"):::external
    end

    %% GitOps and CI/CD
    subgraph "CI/CD & GitOps"
        direction TB
        GH("GitHub Repo"):::git
        Actions("GitHub Actions"):::git
        ArgoCD("ArgoCD Server"):::gitops
    end

    %% Kubernetes Cluster
    subgraph "k3s Cluster"
        direction TB

        %% Infra Namespace
        subgraph "infra Namespace" 
            direction TB
            LB("MetalLB LoadBalancer"):::infra
            Traefik("Traefik IngressController"):::infra
            Cert("cert-manager"):::infra
            PVInfra("HostPath PV & PVC"):::storage
        end

        %% HTPC Namespace
        subgraph "htpc Namespace"
            direction TB
            Sonarr("Sonarr"):::htpc
            Radarr("Radarr"):::htpc
            Prowl("Prowlarr"):::htpc
            Flare("FlareSolverr"):::htpc
            Trans("Transmission"):::htpc
            Jelly("Jellyfin"):::htpc
            PVHTPC("HostPath PV & PVC"):::storage
        end

        %% Utils Namespace
        subgraph "utils Namespace"
            direction TB
            Dashy("Dashy"):::utils
            Next("Nextcloud"):::utils
            Immich("Immich"):::utils
            Tandoor("Tandoor"):::utils
            Postgres("PostgreSQL Instances"):::db
            Redis("Redis"):::db
            PVUtils("HostPath PV & PVC"):::storage
        end
    end

    %% Storage Layer
    subgraph "Storage"
        direction TB
        HostPV("HostPath PersistentVolumes"):::storage
    end

    %% Relationships
    Clients -->|"DNS Lookup"| DNS
    DNS -->|"Ingress IP"| LB
    LB --> Traefik
    Traefik -->|"/services via IngressRoute"| Sonarr
    Traefik --> Radarr
    Traefik --> Prowl
    Traefik --> Flare
    Traefik --> Trans
    Traefik --> Jelly
    Traefik --> Dashy
    Traefik --> Next
    Traefik --> Immich
    Traefik --> Tandoor

    Sonarr <-->|"Indexers API"| Prowl
    Radarr <-->|"Indexers API"| Prowl
    Sonarr --> Trans
    Radarr --> Trans
    Trans -->|"Processed Media"| Jelly

    Next --> Postgres
    Next --> Redis
    Immich --> Postgres
    Tandoor --> Postgres

    Cert ---|ACME DNS-01| DNS

    HostPV --> PVInfra
    HostPV --> PVHTPC
    HostPV --> PVUtils

    GH --> Actions
    Actions -->|"Lint/Validate/Kustomize"| GH
    Actions -->|"Generate install.yaml"| GH
    GH --> ArgoCD
    ArgoCD -->|"Sync Manifests"| k8sAPI["k8s API"]:::k8s
    k8sAPI --> LB
    k8sAPI --> Traefik
    k8sAPI --> Cert
    k8sAPI --> Sonarr
    k8sAPI --> Radarr
    k8sAPI --> Prowl
    k8sAPI --> Flare
    k8sAPI --> Trans
    k8sAPI --> Jelly
    k8sAPI --> Dashy
    k8sAPI --> Next
    k8sAPI --> Immich
    k8sAPI --> Tandoor

    %% Click Events - CI/CD Workflows
    click Actions "https://github.com/chaitanya2692/my-homelab/blob/main/.github/workflows/push.yml"
    click Actions "https://github.com/chaitanya2692/my-homelab/blob/main/.github/workflows/merge.yml"

    %% Click Events - ArgoCD Manifests
    click ArgoCD "https://github.com/chaitanya2692/my-homelab/blob/main/argocd/kustomization.yaml"
    click ArgoCD "https://github.com/chaitanya2692/my-homelab/blob/main/argocd/app/application.yaml"
    click ArgoCD "https://github.com/chaitanya2692/my-homelab/blob/main/argocd/app/argo-non-crds.yaml"
    click ArgoCD "https://github.com/chaitanya2692/my-homelab/blob/main/argocd/app/configmap.yaml"
    click ArgoCD "https://github.com/chaitanya2692/my-homelab/blob/main/argocd/app/deployment.yaml"
    click ArgoCD "https://github.com/chaitanya2692/my-homelab/blob/main/argocd/app/ingress-route.yaml"
    click ArgoCD "https://github.com/chaitanya2692/my-homelab/blob/main/argocd/app/kustomization.yaml"
    click ArgoCD "https://github.com/chaitanya2692/my-homelab/blob/main/argocd/crds/kustomization.yaml"
    click ArgoCD "https://github.com/chaitanya2692/my-homelab/blob/main/argocd/delete_argo.sh"

    %% Click Events - Base Manifests HTPC
    click Sonarr "https://github.com/chaitanya2692/my-homelab/blob/main/base/htpc/sonarr/deployment.yaml"
    click Sonarr "https://github.com/chaitanya2692/my-homelab/blob/main/base/htpc/sonarr/service.yaml"
    click Sonarr "https://github.com/chaitanya2692/my-homelab/blob/main/base/htpc/sonarr/kustomization.yaml"
    click Radarr "https://github.com/chaitanya2692/my-homelab/blob/main/base/htpc/radarr/deployment.yaml"
    click Radarr "https://github.com/chaitanya2692/my-homelab/blob/main/base/htpc/radarr/service.yaml"
    click Radarr "https://github.com/chaitanya2692/my-homelab/blob/main/base/htpc/radarr/kustomization.yaml"
    click Prowl "https://github.com/chaitanya2692/my-homelab/blob/main/base/htpc/prowlarr/deployment.yaml"
    click Prowl "https://github.com/chaitanya2692/my-homelab/blob/main/base/htpc/prowlarr/service.yaml"
    click Prowl "https://github.com/chaitanya2692/my-homelab/blob/main/base/htpc/prowlarr/kustomization.yaml"
    click Trans "https://github.com/chaitanya2692/my-homelab/blob/main/base/htpc/transmission/deployment.yaml"
    click Trans "https://github.com/chaitanya2692/my-homelab/blob/main/base/htpc/transmission/service.yaml"
    click Trans "https://github.com/chaitanya2692/my-homelab/blob/main/base/htpc/transmission/kustomization.yaml"
    click Flare "https://github.com/chaitanya2692/my-homelab/blob/main/base/htpc/flaresolverr/deployment.yaml"
    click Flare "https://github.com/chaitanya2692/my-homelab/blob/main/base/htpc/flaresolverr/service.yaml"
    click Flare "https://github.com/chaitanya2692/my-homelab/blob/main/base/htpc/flaresolverr/kustomization.yaml"
    click Jelly "https://github.com/chaitanya2692/my-homelab/blob/main/base/htpc/jellyfin/deployment.yaml"
    click Jelly "https://github.com/chaitanya2692/my-homelab/blob/main/base/htpc/jellyfin/service.yaml"
    click Jelly "https://github.com/chaitanya2692/my-homelab/blob/main/base/htpc/jellyfin/kustomization.yaml"

    %% Click Events - Base Manifests Infra
    click LB "https://github.com/chaitanya2692/my-homelab/blob/main/base/infra/metallb/metallb.yaml"
    click Traefik "https://github.com/chaitanya2692/my-homelab/blob/main/base/infra/traefik/kustomization.yaml"
    click Cert "https://github.com/chaitanya2692/my-homelab/blob/main/base/infra/cert-manager/kustomization.yaml"
    click Cert "https://github.com/chaitanya2692/my-homelab/blob/main/base/infra/cert-manager/issuers/cluster-issuer.yaml"
    click Cert "https://github.com/chaitanya2692/my-homelab/blob/main/base/infra/cert-manager/certificates/certificate.yaml"
    click PVInfra "https://github.com/chaitanya2692/my-homelab/blob/main/base/infra/local-path-provisioner/storageclass.yaml"

    %% Click Events - Base Manifests Utils
    click Dashy "https://github.com/chaitanya2692/my-homelab/blob/main/base/utils/dashy/config.yaml"
    click Next "https://github.com/chaitanya2692/my-homelab/blob/main/base/utils/nextcloud/nextcloud-deployment.yaml"
    click Next "https://github.com/chaitanya2692/my-homelab/blob/main/base/utils/nextcloud/nextcloud-service.yaml"
    click Immich "https://github.com/chaitanya2692/my-homelab/blob/main/base/utils/immich/kustomization.yaml"
    click Tandoor "https://github.com/chaitanya2692/my-homelab/blob/main/base/utils/tandoor/kustomization.yaml"
    click Postgres "https://github.com/chaitanya2692/my-homelab/blob/main/base/utils/nextcloud/postgres-cluster.yaml"
    click Redis "https://github.com/chaitanya2692/my-homelab/blob/main/base/utils/nextcloud/redis-deployment.yaml"

    %% Styles
    classDef external fill:#f0f0f0,stroke:#333,stroke-width:1px
    classDef git fill:#ffd966,stroke:#b38f00
    classDef gitops fill:#ffe599,stroke:#b38f00
    classDef infra fill:#9fc5e8,stroke:#3d85c6
    classDef htpc fill:#b6d7a8,stroke:#6aa84f
    classDef utils fill:#f9cb9c,stroke:#e69138
    classDef storage fill:#d9d2e9,stroke:#674ea7
    classDef db fill:#c9daf8,stroke:#1155cc
    classDef k8s fill:#d5a6bd,stroke:#741b47,stroke-dasharray: 5 5
```
