# kong/konnect-portal architecture

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

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

## Overview

##### Main Components

a. Frontend Architecture (Core):
- Vue.js Application Layer
- Views Layer (src/views/*)
- Components Layer (src/components/*)
- Store Layer (src/stores/*)
- Router Layer (src/router/*)
- Services Layer (src/services/*)

b. External Services:
- Kong Konnect Backend API
- Authentication Services
- Portal API Service
- LaunchDarkly Feature Flags Service

##### Key Architectural Elements

a. Client-Side Architecture:
- Core Components
- Authentication Flow
- API Documentation Rendering
- Application Management
- Analytics Components

b. Data Flow Layers:
- API Services Layer
- State Management Layer (Pinia Stores)
- Component Communication Layer
- Internationalization System

##### Specific Implementation Details

**[Frontend Application]**
- Core Components
- Authentication (AuthCard, Login, Registration)
- API Documentation (ApiDocumentation/, Spec Renderer)
- Application Management (Applications/)
- Analytics (vitals/)
- Service Layer
- AuthApiService
- PortalV2ApiService
- SessionCookie
- State Management
- App Store
- i18n Store
- Permissions Store
- Product Store
- External Services
- Kong Konnect API
- Feature Flags Service
- Authentication Provider

##### Interaction Flows

- User authentication flow
- API documentation retrieval
- Application registration process
- Analytics data flow
- Internationalization content delivery

##### Technical Stack Indicators

- Vue.js
- Vite
- TypeScript
- Cypress
- Pinia (State Management)
- Kong Konnect Integration

##### Integration touchpoints with Kong Konnect

Keep the abstraction level high enough to be understandable but detailed enough to show the important architectural decisions and patterns used in the application.

Remember to highlight the self-hosted nature of the application and its customization capabilities, as these are key features mentioned in the README.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Vue.js Application"
        App["Vue App"]:::vue
        click App "https://github.com/Kong/konnect-portal/blob/main/src/App.vue"
        
        subgraph "Core Layers"
            Views["Views Layer"]:::core
            click Views "https://github.com/Kong/konnect-portal/tree/main/src/views/"
            Components["Components Layer"]:::core
            click Components "https://github.com/Kong/konnect-portal/tree/main/src/components/"
            Store["Store Layer"]:::core
            click Store "https://github.com/Kong/konnect-portal/tree/main/src/stores/"
            Router["Router Layer"]:::core
            click Router "https://github.com/Kong/konnect-portal/tree/main/src/router/"
            Services["Services Layer"]:::core
            click Services "https://github.com/Kong/konnect-portal/tree/main/src/services/"
        end

        subgraph "Core Components"
            AuthComponents["Authentication Components"]:::auth
            click AuthComponents "https://github.com/Kong/konnect-portal/blob/main/src/components/AuthCard.vue"
            ApiDocs["API Documentation"]:::component
            click ApiDocs "https://github.com/Kong/konnect-portal/tree/main/src/components/ApiDocumentation/"
            AppManagement["Application Management"]:::component
            click AppManagement "https://github.com/Kong/konnect-portal/tree/main/src/views/Applications/"
            Analytics["Analytics"]:::component
            click Analytics "https://github.com/Kong/konnect-portal/tree/main/src/components/vitals/"
            
            subgraph "Catalog Components"
                Catalog["Catalog"]:::component
                click Catalog "https://github.com/Kong/konnect-portal/blob/main/src/components/Catalog.vue"
                CatalogCard["Catalog Card List"]:::component
                click CatalogCard "https://github.com/Kong/konnect-portal/blob/main/src/components/CatalogCardList.vue"
                CatalogItem["Catalog Item"]:::component
                click CatalogItem "https://github.com/Kong/konnect-portal/blob/main/src/components/CatalogItem.vue"
                CatalogTable["Catalog Table List"]:::component
                click CatalogTable "https://github.com/Kong/konnect-portal/blob/main/src/components/CatalogTableList.vue"
            end
        end

        subgraph "Service Layer"
            AuthService["Auth API Service"]:::service
            click AuthService "https://github.com/Kong/konnect-portal/blob/main/src/services/AuthApiService.ts"
            PortalService["Portal V2 API Service"]:::service
            click PortalService "https://github.com/Kong/konnect-portal/blob/main/src/services/PortalV2ApiService.ts"
            SessionService["Session Cookie Service"]:::service
            click SessionService "https://github.com/Kong/konnect-portal/blob/main/src/services/SessionCookie.ts"
        end

        subgraph "State Management"
            AppStore["App Store"]:::store
            click AppStore "https://github.com/Kong/konnect-portal/blob/main/src/stores/app.ts"
            I18nStore["i18n Store"]:::store
            click I18nStore "https://github.com/Kong/konnect-portal/blob/main/src/stores/i18n.ts"
            PermStore["Permissions Store"]:::store
            click PermStore "https://github.com/Kong/konnect-portal/blob/main/src/stores/permissions.ts"
            ProdStore["Product Store"]:::store
            click ProdStore "https://github.com/Kong/konnect-portal/blob/main/src/stores/product.ts"
        end

        subgraph "Features & Testing"
            I18n["Internationalization"]:::util
            click I18n "https://github.com/Kong/konnect-portal/tree/main/src/locales/"
            FeatureFlags["Feature Flags"]:::util
            click FeatureFlags "https://github.com/Kong/konnect-portal/blob/main/src/composables/useLaunchDarkly.ts"
            Testing["Cypress Testing"]:::util
            click Testing "https://github.com/Kong/konnect-portal/tree/main/cypress/"
        end
    end

    subgraph "External Services"
        KongAPI["Kong Konnect API"]:::external
        AuthProvider["Authentication Provider"]:::external
        LaunchDarkly["LaunchDarkly Service"]:::external
    end

    %% Connections
    App --> Views & Components & Store & Router & Services
    AuthComponents --> AuthService
    ApiDocs --> PortalService
    AppManagement --> PortalService
    Analytics --> PortalService
    AuthService --> KongAPI & AuthProvider
    PortalService --> KongAPI
    FeatureFlags --> LaunchDarkly

    %% Styles
    classDef vue fill:#42b883,color:white
    classDef core fill:#3498db,color:white
    classDef component fill:#2ecc71,color:white
    classDef auth fill:#e67e22,color:white
    classDef service fill:#9b59b6,color:white
    classDef store fill:#34495e,color:white
    classDef util fill:#95a5a6,color:white
    classDef external fill:#e74c3c,color:white

    %% Legend
    subgraph Legend
        L1["Vue App"]:::vue
        L2["Core Layer"]:::core
        L3["Component"]:::component
        L4["Auth Component"]:::auth
        L5["Service"]:::service
        L6["Store"]:::store
        L7["Utility"]:::util
        L8["External Service"]:::external
    end
```
