# saikireetigandham/k8s-dashboard architecture

> Architecture diagram of the GitHub repository saikireetigandham/k8s-dashboard, 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/saikireetigandham/k8s-dashboard
- Repository: https://github.com/saikireetigandham/k8s-dashboard

## Overview

Kubernetes Dashboard is a demo-oriented Next.js interface for inspecting cluster state and performing operational workflows. Users browse resource and overview pages, retrieve cluster data through the UI API client and route handlers, and view results; operational actions also mutate resources. The backend supports both synthetic in-memory demo state and live Kubernetes access, with separate metrics and AI-workload views. The README documents additional resource areas whose individual page-to-route wiring was not sampled, so those links are shown only where supported by the README or source index.

Main entry points: [`src/lib/api-client.ts`](https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/lib/api-client.ts) (UI API client), [`src/lib/k8s-store.ts`](https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/lib/k8s-store.ts) (Demo cluster store), [`src/app/api/workloads/route.ts`](https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/app/api/workloads/route.ts) (Workload routes), [`src/app/api/autoscaling/route.ts`](https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/app/api/autoscaling/route.ts) (Autoscaling route)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Dashboard UI"]
  node_dashboard["Dashboard pages<br/>[page.tsx]"]
  node_resource_pages["Resource views"]
  node_ops_tools["Operational tools"]
  node_layout["Dashboard layout"]
  node_api_client["UI API client<br/>[api-client.ts]"]
  node_auth["Demo authentication<br/>[auth-context.tsx]"]
  node_search["Resource search"]
  node_terminal["Terminal and logs<br/>[xterm-terminal.tsx]"]
end

subgraph group_api["API Routes"]
  node_resource_api["Resource routes"]
  node_workloads_api["Workload routes<br/>[route.ts]"]
  node_autoscaling_api["Autoscaling route<br/>[route.ts]"]
  node_ai_api["AI workloads route<br/>[route.ts]"]
  node_actions_api["Action route<br/>[route.ts]"]
  node_exec_api["Pod exec route<br/>[route.ts]"]
end

subgraph group_cluster["Cluster Access"]
  node_k8s_config["Kubernetes config<br/>[k8s-client.ts]"]
  node_demo_store[("Demo cluster store<br/>[k8s-store.ts]")]
  node_demo_data["Synthetic data<br/>[demo-data.ts]"]
end

subgraph group_observability["Metrics and AI"]
  node_metrics_hooks["Realtime hooks"]
  node_metrics_client["Metrics client<br/>[metrics-client.ts]"]
  node_ai_page["AI inventory page<br/>[page.tsx]"]
end

node_user(("Cluster operator"))
node_kubernetes{{"Kubernetes cluster"}}

node_user -->|"opens dashboard"| node_dashboard
node_dashboard -->|"renders through"| node_layout
node_user -->|"explores resources"| node_resource_pages
node_resource_pages -.->|"requests cluster data"| node_api_client
node_layout -->|"requests cluster data"| node_api_client
node_api_client -->|"fetches resource routes"| node_resource_api
node_api_client -->|"fetches workloads"| node_workloads_api
node_api_client -->|"fetches autoscaling"| node_autoscaling_api
node_api_client -->|"fetches AI inventory"| node_ai_api
node_workloads_api -->|"lists cluster workloads"| node_kubernetes
node_workloads_api -->|"reads demo workloads"| node_demo_store
node_autoscaling_api -->|"gets cluster config"| node_k8s_config
node_autoscaling_api -->|"lists autoscalers"| node_kubernetes
node_ai_api -->|"gets cluster config"| node_k8s_config
node_ai_api -->|"lists nodes and pods"| node_kubernetes
node_actions_api -->|"performs resource actions"| node_kubernetes
node_actions_api -->|"applies demo actions"| node_demo_store
node_exec_api -->|"runs demo commands"| node_demo_store
node_ops_tools -.->|"uses API access"| node_api_client
node_search -->|"navigates to views"| node_resource_pages
node_terminal -.->|"requests pod exec"| node_exec_api
node_metrics_hooks -->|"subscribes to metrics"| node_metrics_client
node_ai_page -.->|"loads AI inventory"| node_api_client
node_auth -.->|"gates access"| node_dashboard
node_demo_data -.->|"supplies demo state"| node_demo_store

click node_dashboard "https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/app/page.tsx"
click node_resource_pages "https://github.com/saikireetigandham/k8s-dashboard/tree/main/src/app"
click node_ops_tools "https://github.com/saikireetigandham/k8s-dashboard/tree/main/src/components"
click node_layout "https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/components/dashboard-layout.tsx"
click node_api_client "https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/lib/api-client.ts"
click node_resource_api "https://github.com/saikireetigandham/k8s-dashboard/tree/main/src/app/api"
click node_workloads_api "https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/app/api/workloads/route.ts"
click node_autoscaling_api "https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/app/api/autoscaling/route.ts"
click node_ai_api "https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/app/api/ai-workloads/route.ts"
click node_actions_api "https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/app/api/actions/route.ts"
click node_exec_api "https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/app/api/exec/route.ts"
click node_k8s_config "https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/lib/k8s-client.ts"
click node_demo_store "https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/lib/k8s-store.ts"
click node_auth "https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/contexts/auth-context.tsx"
click node_search "https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/components/enhanced-search.tsx"
click node_terminal "https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/components/xterm-terminal.tsx"
click node_metrics_hooks "https://github.com/saikireetigandham/k8s-dashboard/tree/main/src/hooks"
click node_metrics_client "https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/lib/metrics-client.ts"
click node_ai_page "https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/app/ai-workloads/page.tsx"
click node_demo_data "https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/lib/demo-data.ts"

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_dashboard,node_resource_pages,node_ops_tools,node_layout,node_api_client,node_auth,node_search,node_terminal toneBlue
class node_resource_api,node_workloads_api,node_autoscaling_api,node_ai_api,node_actions_api,node_exec_api toneAmber
class node_k8s_config,node_demo_store,node_demo_data toneMint
class node_metrics_hooks,node_metrics_client,node_ai_page toneRose
class node_user,node_kubernetes toneIndigo
```

## Components

### Dashboard UI

- [Dashboard pages](https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Resource views](https://github.com/saikireetigandham/k8s-dashboard/tree/main/src/app): `src/app`
- [Operational tools](https://github.com/saikireetigandham/k8s-dashboard/tree/main/src/components): `src/components`
- [Dashboard layout](https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/components/dashboard-layout.tsx): `src/components/dashboard-layout.tsx`
- [UI API client](https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/lib/api-client.ts): `src/lib/api-client.ts`
- [Demo authentication](https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/contexts/auth-context.tsx): `src/contexts/auth-context.tsx`
- [Resource search](https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/components/enhanced-search.tsx): `src/components/enhanced-search.tsx`
- [Terminal and logs](https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/components/xterm-terminal.tsx): `src/components/xterm-terminal.tsx`

### API Routes

- [Resource routes](https://github.com/saikireetigandham/k8s-dashboard/tree/main/src/app/api): `src/app/api`
- [Workload routes](https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/app/api/workloads/route.ts): `src/app/api/workloads/route.ts`
- [Autoscaling route](https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/app/api/autoscaling/route.ts): `src/app/api/autoscaling/route.ts`
- [AI workloads route](https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/app/api/ai-workloads/route.ts): `src/app/api/ai-workloads/route.ts`
- [Action route](https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/app/api/actions/route.ts): `src/app/api/actions/route.ts`
- [Pod exec route](https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/app/api/exec/route.ts): `src/app/api/exec/route.ts`

### Cluster Access

- [Kubernetes config](https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/lib/k8s-client.ts): `src/lib/k8s-client.ts`
- [Demo cluster store](https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/lib/k8s-store.ts): `src/lib/k8s-store.ts`
- [Synthetic data](https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/lib/demo-data.ts): `src/lib/demo-data.ts`

### Metrics and AI

- [Realtime hooks](https://github.com/saikireetigandham/k8s-dashboard/tree/main/src/hooks): `src/hooks`
- [Metrics client](https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/lib/metrics-client.ts): `src/lib/metrics-client.ts`
- [AI inventory page](https://github.com/saikireetigandham/k8s-dashboard/blob/main/src/app/ai-workloads/page.tsx): `src/app/ai-workloads/page.tsx`

### Other components

- **Cluster operator**
- **Kubernetes cluster**

## Connections

- Cluster operator → Dashboard pages: opens dashboard (evidence: `README.md`)
- Dashboard pages → Dashboard layout: renders through (evidence: `src/components/dashboard-layout.tsx`)
- Cluster operator → Resource views: explores resources (evidence: `README.md`)
- Resource views → UI API client: requests cluster data (evidence: `src/app/api/gateways/route.ts`)
- Dashboard layout → UI API client: requests cluster data (evidence: `src/components/dashboard-layout.tsx`)
- UI API client → Resource routes: fetches resource routes (evidence: `src/lib/api-client.ts`)
- UI API client → Workload routes: fetches workloads (evidence: `src/lib/api-client.ts`)
- UI API client → Autoscaling route: fetches autoscaling (evidence: `src/lib/api-client.ts`)
- UI API client → AI workloads route: fetches AI inventory (evidence: `src/lib/api-client.ts`)
- Workload routes → Kubernetes cluster: lists cluster workloads (evidence: `src/app/api/workloads/route.ts`)
- Workload routes → Demo cluster store: reads demo workloads (evidence: `src/app/api/workloads/route.ts`)
- Autoscaling route → Kubernetes config: gets cluster config (evidence: `src/app/api/autoscaling/route.ts`)
- Autoscaling route → Kubernetes cluster: lists autoscalers (evidence: `src/app/api/autoscaling/route.ts`)
- AI workloads route → Kubernetes config: gets cluster config (evidence: `src/app/api/ai-workloads/route.ts`)
- AI workloads route → Kubernetes cluster: lists nodes and pods (evidence: `src/app/api/ai-workloads/route.ts`)
- Action route → Kubernetes cluster: performs resource actions (evidence: `src/app/api/actions/route.ts`)
- Action route → Demo cluster store: applies demo actions (evidence: `src/app/api/actions/route.ts`)
- Pod exec route → Demo cluster store: runs demo commands (evidence: `src/app/api/exec/route.ts`)
- Operational tools → UI API client: uses API access (evidence: `src/components/dashboard-layout.tsx`)
- Resource search → Resource views: navigates to views (evidence: `src/components/enhanced-search.tsx`)
- Terminal and logs → Pod exec route: requests pod exec
- Realtime hooks → Metrics client: subscribes to metrics (evidence: `src/hooks/use-real-time-metrics.ts`)
- AI inventory page → UI API client: loads AI inventory
- Demo authentication → Dashboard pages: gates access
- Synthetic data → Demo cluster store: supplies demo state
