# juspay/hyperswitch-helm architecture

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

- Interactive diagram: https://gitdiagram.com/juspay/hyperswitch-helm
- Repository: https://github.com/juspay/hyperswitch-helm

## Overview

##### Project Type and Purpose
- The README clearly states that Hyperswitch is “the open-source payments switch” – a community-led project that provides a single API interface to access diverse payment infrastructures.
- The emphasis on Helm (with charts and related files) indicates that the deployment is intended to be orchestrated in a Kubernetes environment.
- Given the multiple components (app, card vault, keymanager, istio, web, etc.), the project employs a microservices architecture.

##### Analyzing the File Structure
- hyperswitch-app: Likely the core payment routing or business logic service.
- hyperswitch-card-vault: Handles sensitive card data storage (vaulting).
- hyperswitch-istio: Contains networking or ingress configuration via Istio resources.
- hyperswitch-keymanager: Manages encryption keys and secrets.
- hyperswitch-stack: Appears to be a meta-chart bundling the above components together.
- hyperswitch-web: Likely provides a web interface or API frontend for consuming the platform.
- In addition, directories such as “load_test” and “misc/cypress” suggest there are testing scripts for load testing and end-to-end validations using Cypress.
- The presence of versioned release directories (v0.1.1, v0.2.2, etc.) indicate an established versioning and release strategy for the Helm charts.

##### Key Components and Their Interactions
a. Main Components:
- Hyperswitch App: The core payment processing and routing logic.
- Hyperswitch Card Vault: A dedicated service for secure card storage.
- Hyperswitch Keymanager: Handles key management, encryption, and secure operations.
- Hyperswitch Istio: Implements ingress routing, traffic management, and gateway configuration with Istio.
- Hyperswitch Web: Provides the frontend or API interface.
- Supporting services: Included via Helm dependencies such as Kafka (messaging), PostgreSQL (transactional data), Redis (caching), ClickHouse (analytics), Mailhog (email testing), and Loki/Grafana (logging and monitoring).

b. Relationships and Interactions:
- The Hyperswitch Web service likely acts as the point of entry for API calls or web interface interactions.
- Incoming requests are routed (possibly via the Istio configuration) to the appropriate microservice – either the App for processing or to the Card Vault/Keymanager as needed.
- The services communicate with supporting systems such as databases (PostgreSQL), caches (Redis), message brokers (Kafka), and logging/monitoring stacks.

##### Architectural Patterns & Design Principles
- Microservices Architecture: Each component (app, vault, keymanager, web) is designed as an independent Helm chart that can be deployed and scaled separately.
- Containerized Deployment on Kubernetes: Deployment configuration files like deployment.yaml, service.yaml, ingress.yaml, and configuration templates in each service indicate Kubernetes as the orchestration platform.
- Infrastructure as Code: Helm charts define the infrastructure, promoting repeatable deployments.
- Versioning & Release Management: Version directories (v0.1.1, etc.) show a clear versioning strategy.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Ingress/Networking Layer
    subgraph "Ingress/Networking"
        I("Hyperswitch Istio"):::ingress
    end

    %% API Layer
    subgraph "API Layer"
        W("Hyperswitch Web"):::frontend
    end

    %% Application Layer
    subgraph "Application Layer"
        A("Hyperswitch App"):::service
    end

    %% Auxiliary Services Layer
    subgraph "Auxiliary Services"
        CV("Hyperswitch Card Vault"):::auxiliary
        KM("Hyperswitch Keymanager"):::auxiliary
    end

    %% Data/Integration Layer
    subgraph "Data/Integration Layer"
        KAFKA("Kafka(Messaging)"):::integration
        PG("PostgreSQL(Database)"):::integration
        REDIS("Redis(Caching)"):::integration
        CH("ClickHouse(Analytics)"):::integration
        MAILHOG("Mailhog(Email)"):::integration
        GRAFANA("Loki/Grafana(LoggingMonitoring)"):::integration
    end

    %% Meta-Deployment (Helm Bundling)
    subgraph "Meta Deployment"
        STACK("Hyperswitch Stack"):::meta
    end

    %% Testing Layer
    subgraph "Testing Layer"
        LT("Load Testing Scripts"):::testing
        CYP("End-To-End Testing(Cypress)"):::testing
    end

    %% Arrows to represent flow
    I -->|"routes"| W
    W -->|"processes"| A
    A -->|"delegates"| CV
    A -->|"delegates"| KM
    A -->|"publishes"| KAFKA
    A -->|"stores"| PG
    A -->|"caches"| REDIS
    A -->|"analytics"| CH
    A -->|"emails"| MAILHOG
    A -->|"logs"| GRAFANA

    %% Meta Deployment bundles the core microservices
    STACK --- I
    STACK --- W
    STACK --- A
    STACK --- CV
    STACK --- KM

    %% Styles
    classDef ingress fill:#A9DFBF,stroke:#196F3D,stroke-width:2px;
    classDef frontend fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef service fill:#F9E79F,stroke:#9A7D0A,stroke-width:2px;
    classDef auxiliary fill:#FAD7A0,stroke:#B9770E,stroke-width:2px;
    classDef integration fill:#D5F5E3,stroke:#1E8449,stroke-width:2px;
    classDef meta fill:#D2B4DE,stroke:#6C3483,stroke-width:2px;
    classDef testing fill:#F5CBA7,stroke:#B03A2E,stroke-width:2px;

    %% Click Events
    click I "https://github.com/juspay/hyperswitch-helm/tree/main/charts/incubator/hyperswitch-istio"
    click W "https://github.com/juspay/hyperswitch-helm/tree/main/charts/incubator/hyperswitch-web"
    click A "https://github.com/juspay/hyperswitch-helm/tree/main/charts/incubator/hyperswitch-app"
    click CV "https://github.com/juspay/hyperswitch-helm/tree/main/charts/incubator/hyperswitch-card-vault"
    click KM "https://github.com/juspay/hyperswitch-helm/tree/main/charts/incubator/hyperswitch-keymanager"
    click STACK "https://github.com/juspay/hyperswitch-helm/tree/main/charts/incubator/hyperswitch-stack"
    click LT "https://github.com/juspay/hyperswitch-helm/tree/main/load_test"
    click CYP "https://github.com/juspay/hyperswitch-helm/tree/main/misc/cypress"
```
