# tektoncd/dashboard architecture

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

- Interactive diagram: https://gitdiagram.com/tektoncd/dashboard
- Repository: https://github.com/tektoncd/dashboard

## Overview

##### Project type and purpose
- This is a full-stack web application (“Tekton Dashboard”) consisting of:
– A Go‐based backend (cmd/dashboard, pkg/) that exposes REST endpoints and serves static assets
– A React/Vite single-page frontend (src/, packages/components, packages/graph, packages/utils)
– Kubernetes/Tekton deployment manifests (config/, tekton/) for running on a cluster
- Purpose: provide a web UI for viewing and managing Tekton Pipelines and Triggers via the Kubernetes API

##### Key architectural components
– Frontend SPA
- src/containers, src/components: container & presentational components
- packages/components, packages/graph, packages/utils: shared component libraries and graph rendering
- Storybook & Cypress (packages/e2e) for component and E2E testing
- Vite-based build (vite.config.js)
– Backend API server
- cmd/dashboard/main.go: entrypoint
- pkg/router/router.go: HTTP routing
- pkg/endpoints/*.go: REST handlers for pipelines, tasks, logs, health, etc.
- pkg/utils (csrf, proxy): cross-site protection, proxying to k8s API
- No external database: state is fetched directly from Kubernetes API
– Kubernetes integration
- config/: kustomize overlays for namespace, roles, deployments, services
- tekton/: Tekton pipeline definitions for CI/CD (build, publish, release pipelines)
– CI/CD pipelines
- GitHub Actions (.github/workflows) and Tekton pipelines (tekton/) for build/test/release
– External systems
- Kubernetes API server (CRDs: PipelineRun, TaskRun, Triggers, etc.)
- Git repositories (import resources)
- OAuth2 proxy if enabled (docs/walkthrough)

##### How to represent this
- Browser (React SPA)
- Frontend static files (served by Go server)
- Backend API server (Go)
- Kubernetes API server (with Tekton CRDs)
- CI/CD pipelines (GitHub Actions, Tekton pipelines)
- External Git server (for resource import)
- (Optional) OAuth2 Proxy / Identity Provider

1. User → Browser (interacts via UI)
2. Browser → Backend API (HTTPS calls to REST endpoints)
3. Backend → Kubernetes API (client-go requests for CRDs)
4. Backend → External Git (import endpoints)
5. GitHub Actions / Tekton pipelines → Build & deploy steps → Kubernetes cluster
6. Browser ←> OAuth2 Proxy (if authentication is enabled)

c. Architectural patterns & design principles:
- SPA with container/presentational component separation
- Backend API follows REST principles, no DB – acting as a proxy to k8s API
- Monorepo managing multiple npm packages (components, graph, utils)
- Kustomize overlays for environment-specific Kubernetes configs
- Infrastructure as Code (Tekton CI/CD pipelines)

d. Key technologies & frameworks:
- Frontend: React, Vite, Storybook, Cypress
- Backend: Go, Gorilla Mux router (pkg/router), client-go for k8s
- Deployment: Kubernetes, Kustomize, Tekton Pipelines & Triggers
- CI: GitHub Actions, Tekton CI pipelines

##### Elements
– Blue for user-facing components (Browser, SPA)
– Green for backend services (API server)
– Orange for infrastructure (Kubernetes, Tekton)
– Gray for CI/CD and external services

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "User"
        Browser["User Browser"]:::blue
    end

    subgraph "Frontend SPA"
        IndexHTML["index.html"]:::blue
        IndexJS["src/index.jsx"]:::blue
        Containers["src/containers/"]:::blue
        Routes["src/routes/"]:::blue
        Styles["src/scss/"]:::blue
    end

    subgraph "Shared Libraries"
        Components["packages/components/"]:::blue
        GraphLib["packages/graph/"]:::blue
        UtilsLib["packages/utils/"]:::blue
    end

    subgraph "Storybook"
        SB[".storybook/"]:::gray
    end

    subgraph "E2E Testing"
        E2E["packages/e2e/"]:::gray
    end

    subgraph "Build Config"
        Vite["vite.config.js"]:::gray
        ViteA["vite.config.analyze.js"]:::gray
        Ko[".ko.yaml"]:::gray
    end

    subgraph "Go API Server"
        Main["cmd/dashboard/main.go"]:::green
        Router["pkg/router/router.go"]:::green
        Endpoints["pkg/endpoints/"]:::green
        CSRF["pkg/csrf/csrf.go"]:::green
        Proxy["pkg/utils/proxy.go"]:::green
        Flush["pkg/utils/flushwriter.go"]:::green
        UtilsGO["pkg/utils/utils.go"]:::green
        Logging["pkg/logging/logging.go"]:::green
    end

    subgraph "Kubernetes Cluster"
        K8sAPI["Kubernetes API Server\n(Tekton CRDs)"]:::orange
        DashboardDeploy["Dashboard Deployment"]:::orange
    end

    subgraph "Infrastructure Config"
        Config["config/"]:::orange
        ConfigFE["config_frontend/"]:::orange
        TektonP["tekton/"]:::orange
        GitHubActions[".github/workflows/"]:::gray
    end

    ExternalGit["External Git Server"]:::gray
    OAuth["OAuth2 Proxy"]:::gray
    Extensions["docs/extensions.md"]:::gray
    Walkthrough["docs/walkthrough/walkthrough-oauth2-proxy.md"]:::gray

    Browser -->|"loads index.html"| IndexHTML
    Browser -->|"executes SPA"| IndexJS
    IndexJS --> Containers
    IndexJS --> Routes
    IndexJS --> Styles
    Containers --> Components
    Containers --> GraphLib
    Containers --> UtilsLib
    Extensions --> IndexJS

    Browser -->|"REST API calls"| Main
    Main --> Router
    Router --> Endpoints
    Endpoints -->|"client-go List CRDs"| K8sAPI
    Main --> CSRF
    Main --> Proxy
    Main --> Flush
    Main --> UtilsGO
    Main --> Logging
    Main -->|"imports resources"| ExternalGit
    Walkthrough --> OAuth
    OAuth <-->|"auth redirect"| Browser
    OAuth --> Main

    GitHubActions --> Vite
    GitHubActions --> Ko
    Vite --> IndexJS
    Ko --> Main

    GitHubActions --> TektonP
    TektonP --> DashboardDeploy
    Config --> DashboardDeploy
    ConfigFE --> DashboardDeploy
    DashboardDeploy --> K8sAPI

    click IndexHTML "https://github.com/tektoncd/dashboard/blob/main/index.html"
    click IndexJS "https://github.com/tektoncd/dashboard/blob/main/src/index.jsx"
    click Containers "https://github.com/tektoncd/dashboard/tree/main/src/containers/"
    click Routes "https://github.com/tektoncd/dashboard/tree/main/src/routes/"
    click Styles "https://github.com/tektoncd/dashboard/tree/main/src/scss/"
    click Components "https://github.com/tektoncd/dashboard/tree/main/packages/components/"
    click GraphLib "https://github.com/tektoncd/dashboard/tree/main/packages/graph/"
    click UtilsLib "https://github.com/tektoncd/dashboard/tree/main/packages/utils/"
    click SB "https://github.com/tektoncd/dashboard/tree/main/.storybook/"
    click E2E "https://github.com/tektoncd/dashboard/tree/main/packages/e2e/"
    click Vite "https://github.com/tektoncd/dashboard/blob/main/vite.config.js"
    click ViteA "https://github.com/tektoncd/dashboard/blob/main/vite.config.analyze.js"
    click Ko "https://github.com/tektoncd/dashboard/blob/main/.ko.yaml"
    click Main "https://github.com/tektoncd/dashboard/blob/main/cmd/dashboard/main.go"
    click Router "https://github.com/tektoncd/dashboard/blob/main/pkg/router/router.go"
    click Endpoints "https://github.com/tektoncd/dashboard/tree/main/pkg/endpoints/"
    click CSRF "https://github.com/tektoncd/dashboard/blob/main/pkg/csrf/csrf.go"
    click Proxy "https://github.com/tektoncd/dashboard/blob/main/pkg/utils/proxy.go"
    click Flush "https://github.com/tektoncd/dashboard/blob/main/pkg/utils/flushwriter.go"
    click UtilsGO "https://github.com/tektoncd/dashboard/blob/main/pkg/utils/utils.go"
    click Logging "https://github.com/tektoncd/dashboard/blob/main/pkg/logging/logging.go"
    click Config "https://github.com/tektoncd/dashboard/tree/main/config/"
    click ConfigFE "https://github.com/tektoncd/dashboard/tree/main/config_frontend/"
    click TektonP "https://github.com/tektoncd/dashboard/tree/main/tekton/"
    click GitHubActions "https://github.com/tektoncd/dashboard/tree/main/.github/workflows/"
    click Extensions "https://github.com/tektoncd/dashboard/blob/main/docs/extensions.md"
    click Walkthrough "https://github.com/tektoncd/dashboard/blob/main/docs/walkthrough/walkthrough-oauth2-proxy.md"

    classDef blue fill:#1f77b4,stroke:#000,color:#fff
    classDef green fill:#2ca02c,stroke:#000,color:#fff
    classDef orange fill:#ff7f0e,stroke:#000,color:#fff
    classDef gray fill:#7f7f7f,stroke:#000,color:#fff
```
