# kong/kong-manager architecture

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

- Interactive diagram: https://gitdiagram.com/kong/kong-manager
- Repository: https://github.com/kong/kong-manager

## Overview

##### Project Type and Purpose
- Kong Manager OSS is an open-source, frontend-based application built with Vue that provides a UI for interacting with Kong Gateway’s admin API. It does not contain its own backend database but relies on Kong Gateway to store and manage configuration.
- The project’s purpose is to allow users to view, edit, and manage Kong Gateway resources (like services, routes, plugins, certificates, etc.) by acting as a user-friendly layer on top of the admin API.

##### Identifying Main Components
- Frontend Application:
– Located mainly within the “src” directory. Components include files like App.vue, the layout in index.html, and Vue-based pages (e.g., pages for ca-certificates, certificates, services, consumers, plugins, etc.).
– The “src/services/apiService.ts” module indicates the application’s dedicated layer for interacting with the Kong admin API.
– Vue composables (in “src/composables”) and a well-structured organization of pages and components demonstrate adherence to modern SPA architectural patterns.
- External Service – Kong Gateway:
– The actual Kong Gateway instance is external (or can be run locally via the quickstart instructions). It is the target for all admin API requests made by Kong Manager OSS.
– The README emphasizes that the UI requires a running Kong Gateway instance (version 3.4+).
- Testing and CI Pipeline:
– There is an extensive “tests” directory with Playwright end-to-end tests indicating how the UI is validated against expected behavior.
– CI/CD configuration files in “.ci” and “.github” indicate automated tests, building, docker image creation, and deployment procedures.
- Build and Dependency Management:
– The project uses pnpm (as seen in package.json and pnpm-lock.yaml), Node.js (version 18+ in README), and Vite (vite.config.ts) for building and serving the application.

##### Relationships and Interactions
- Clients (browsers/users) access the static assets (index.html, public assets) that are served by a web server. These assets compile the Vue-based frontend.
- The UI application makes REST API calls to the Kong Gateway admin API through the API service layer.
- Data flows from the Kong Gateway to the UI and vice versa. The API service abstracts the HTTP calls, transforming configuration data for display and modification.
- CI/CD pipelines (using GitHub Actions and custom scripts in “.ci”) run tests (Playwright specs) and build/deploy the application. These pipelines are connected to the repository’s structure as indicated by the organized workflow and configuration files.

##### Architectural Patterns and Technology Usage
- The UI follows a component-based and modular architecture using Vue with components, composables, and Vue Router (src/router.ts) to manage state, navigation, and business logic.
- Separation of concerns is evident between the presentation layer (components/pages) and the communication layer (src/services/apiService.ts) that handles API interactions.
- The project uses modern JavaScript/TypeScript practices with configuration files (tsconfig.json, eslint.config.mjs, etc.) and utilizes Vite for module bundling and development server purposes.
- CI/CD and testing are highly automated, with Docker, GitHub Actions workflows, and Playwright tests ensuring the integration between the UI and Kong Gateway remains reliable.

– Ensure each component is clearly labelled. For instance, “Vue Components / Pages”, “API Service Layer”, “Router & State Management”, etc.
- Data flow: Browser → Kong Manager OSS (UI served) → Kong Admin API.
- CI/CD & testing flows that run builds, tests, and deployment procedures.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Global nodes
    Browser["Client (Browser)"]:::client

    %% Kong Manager OSS Frontend Subgraph
    subgraph "Kong Manager OSS Frontend"
        FE["Frontend Application"]:::frontend
        UIComp["UI Components"]:::frontend
        UIPages["UI Pages"]:::frontend
        APISvc["API Service Layer"]:::frontend
        Router["Routing & State Management"]:::frontend
        Stores["Stores"]:::frontend
        Composables["Vue Composables"]:::frontend
    end

    %% External Service
    EKG["External Kong Gateway (Admin API)"]:::external

    %% Project Infrastructure Subgraph
    subgraph "Project Infrastructure"
        Build["Build & Dependency Management"]:::build
        ViteConfig["Vite Config"]:::build
        Testing["Testing Environment (Playwright)"]:::ci
        CIConfig["CI Config (.ci)"]:::ci
        GitHubActions["GitHub Actions (.github/workflows)"]:::ci
    end

    %% Relationships
    Browser -->|"loads"| FE
    FE -->|"composes"| UIComp
    FE -->|"composes"| UIPages
    FE -->|"integrates"| APISvc
    FE -->|"routes"| Router
    FE -->|"manages"| Stores
    FE -->|"uses"| Composables
    APISvc -->|"calls"| EKG
    CIConfig -->|"triggers"| Build
    GitHubActions -->|"triggers"| Build
    Build -->|"deploys"| FE

    %% Click Events for Frontend Application
    click FE "https://github.com/kong/kong-manager/tree/main/src/"
    click APISvc "https://github.com/kong/kong-manager/blob/main/src/services/apiService.ts"
    click UIComp "https://github.com/kong/kong-manager/tree/main/src/components"
    click UIPages "https://github.com/kong/kong-manager/tree/main/src/pages"
    click Router "https://github.com/kong/kong-manager/blob/main/src/router.ts"
    click Stores "https://github.com/kong/kong-manager/blob/main/src/stores/info.ts"
    click Composables "https://github.com/kong/kong-manager/tree/main/src/composables"

    %% Click Events for Project Infrastructure
    click Build "https://github.com/kong/kong-manager/blob/main/package.json"
    click ViteConfig "https://github.com/kong/kong-manager/blob/main/vite.config.ts"
    click Testing "https://github.com/kong/kong-manager/tree/main/tests/"
    click CIConfig "https://github.com/kong/kong-manager/blob/main/.ci"
    click GitHubActions "https://github.com/kong/kong-manager/tree/main/.github/workflows"

    %% Styles
    classDef client fill:#ADD8E6,stroke:#000,stroke-width:2px
    classDef frontend fill:#87CEFA,stroke:#000,stroke-width:2px
    classDef build fill:#FFC0CB,stroke:#000,stroke-width:2px
    classDef ci fill:#FFA500,stroke:#000,stroke-width:2px
    classDef external fill:#90EE90,stroke:#000,stroke-width:2px
```
