How juspay/hyperswitch-suite works
Purpose and Entry Points
This repository is the AWS infrastructure-as-code layer for deploying Hyperswitch, the open-source payments switch. It does not contain the Rust app server itself; it provisions its hosting platform, supporting services, Kubernetes add-ons, edge delivery, and operational tooling.
Primary operational entry points are environment-specific Terraform stacks under terraform/aws/live, beginning with the populated dev region:
• terraform/aws/live/dev/eu-central-1
• terraform/aws/live/dev/eu-central-1/eks/main.tf
• terraform/aws/live/dev/eu-central-1/apps/hyperswitch-app/main.tf
Bootstrap stacks establish Terraform backend/foundation resources per environment:
• terraform/aws/bootstrap/dev/main.tf
• terraform/aws/modules/composition/terraform-backend/main.tf
Terraform Layering and Environment Boundary
Infrastructure is organized into reusable base primitives, higher-level AWS compositions, and deployable live stacks. Live stacks supply environment/region inputs and state backends; they invoke modules rather than directly defining most infrastructure.
• Base AWS abstractions: terraform/aws/modules/base/vpc/main.tf, terraform/aws/modules/base/eks/main.tf, terraform/aws/modules/base/s3-bucket/main.tf
• Service compositions: terraform/aws/modules/composition/vpc-network/main.tf, terraform/aws/modules/composition/eks/main.tf, terraform/aws/modules/composition/database/main.tf
• Dev deployment instances: terraform/aws/live/dev/eu-central-1/vpc-network/main.tf, terraform/aws/live/dev/eu-central-1/database/main.tf
dev, integ, prod, and sandbox are explicit deployment boundaries. Only dev has a detailed regional implementation in this tree; the others primarily provide scaffolding/readmes.
Network, Access, and Compute Foundation
The platform establishes a VPC-oriented private network, routing/ACLs/endpoints, security rules, an EKS cluster, and controlled administrative/proxy access. This is the foundational dependency chain for workloads and data stores.
• Network topology and endpoints: terraform/aws/modules/composition/vpc-network/main.tf, terraform/aws/modules/composition/vpc-network/vpc-endpoints.tf
• EKS cluster, node groups, add-ons, and IAM: terraform/aws/modules/composition/eks/main.tf, terraform/aws/modules/composition/eks/node-group.tf, terraform/aws/live/dev/eu-central-1/eks/main.tf
• Network-security deployment: terraform/aws/live/dev/eu-central-1/security-rules/main.tf
• Administrative jump host and outbound Squid proxy: terraform/aws/live/dev/eu-central-1/jump-host/main.tf, terraform/aws/live/dev/eu-central-1/squid-proxy/main.tf
AWS is the material runtime; Kubernetes/EKS hosts the application plane.
Application Delivery and Kubernetes Control Plane
EKS add-ons are provisioned separately from cluster creation, then application-level stacks configure Kubernetes resources and supporting controllers. Argo CD is present for GitOps-style deployment management; AWS Load Balancer Controller and Istio provide ingress/load-balancing and service-mesh capabilities.
• Kubernetes shared resources: terraform/aws/live/dev/eu-central-1/eks-kubernetes-resources/main.tf
• Argo CD: terraform/aws/live/dev/eu-central-1/apps/argocd/main.tf, terraform/aws/modules/application-resources/argocd/main.tf
• AWS Load Balancer Controller: terraform/aws/live/dev/eu-central-1/apps/alb-controller/main.tf
• Istio: terraform/aws/live/dev/eu-central-1/apps/istio/main.tf
• Hyperswitch workload integration: terraform/aws/live/dev/eu-central-1/apps/hyperswitch-app/main.tf, terraform/aws/modules/application-resources/hyperswitch/main.tf
The intended flow is edge/load-balancer traffic into EKS-hosted Hyperswitch services, with workload credentials and infrastructure dependencies assembled through Terraform.
Data, Secrets, and Application Dependencies
The deployment supports several persistence and caching/search systems, provisioned as independent stacks. This separation makes lifecycle, scaling, and access control distinct from the application workload.
• Relational database composition and dev stack: terraform/aws/modules/composition/database/main.tf, terraform/aws/live/dev/eu-central-1/database/main.tf
• Cassandra: terraform/aws/modules/composition/cassandra/main.tf, terraform/aws/live/dev/eu-central-1/cassandra/main.tf
• ElastiCache: terraform/aws/modules/composition/elasticache/main.tf, terraform/aws/live/dev/eu-central-1/elasticache/main.tf
• OpenSearch: terraform/aws/modules/composition/opensearch/main.tf, terraform/aws/live/dev/eu-central-1/opensearch/main.tf
• External Secrets Operator and Hyperswitch-specific secret integration: terraform/aws/live/dev/eu-central-1/apps/external-secrets-operator/main.tf, terraform/aws/live/dev/eu-central-1/apps/eso-hyperswitch/main.tf
KMS and S3 resources are integrated into the Hyperswitch application module:
• terraform/aws/modules/application-resources/hyperswitch/kms.tf
• terraform/aws/modules/application-resources/hyperswitch/s3.tf
Edge, Observability, and Validation
CloudFront is configured declaratively from distribution, policy, function, and origin configuration files, forming the public edge boundary for API, media, and web-app routes. Observability is Kubernetes-oriented: Vector collects logs, Loki stores them, and Grafana exposes visualization.
• CDN configuration: terraform/aws/live/dev/eu-central-1/cloudfront/main.tf, terraform/aws/live/dev/eu-central-1/cloudfront/config/distributions/api-cdn.yaml
• Envoy proxy configuration: terraform/aws/live/dev/eu-central-1/envoy-proxy/config/envoy.yaml
• Logging/visualization stacks: terraform/aws/live/dev/eu-central-1/apps/vector/main.tf, terraform/aws/live/dev/eu-central-1/apps/loki/main.tf, terraform/aws/live/dev/eu-central-1/apps/grafana/main.tf
• Load testing uses Python/Locust: load-test/locustfile.py, load-test/requirements.txt
GitHub Actions validate Terraform and generate module documentation:
• .github/workflows/terraform-validate.yml
• .github/workflows/terraform-docs.yml
Components 19
Terraform delivery
Reusable modules and environment stacks.
- State backend bootstrap · Creates per-environment Terraform foundation resources.
terraform/aws/bootstrap/dev/main.tf - Dev regional stacks · Environment inputs and deployable module instances.
terraform/aws/live/dev/eu-central-1 - VPC network composition · Private topology, routing, ACLs, and endpoints.
terraform/aws/modules/composition/vpc-network/main.tf - EKS composition · Cluster, node groups, add-ons, and IAM.
terraform/aws/modules/composition/eks/main.tf - Hyperswitch module · Workload integration plus KMS and S3 resources.
terraform/aws/modules/application-resources/hyperswitch/main.tf
AWS foundation
Network, compute, controlled access, and data services.
- VPC and endpoints
terraform/aws/live/dev/eu-central-1/vpc-network/main.tf - Security rules
terraform/aws/live/dev/eu-central-1/security-rules/main.tf - EKS cluster · Hosts the application plane.
terraform/aws/live/dev/eu-central-1/eks/main.tf - Jump host and proxy · Controlled administration and outbound proxy access.
terraform/aws/live/dev/eu-central-1/jump-host/main.tf - Data services · Relational DB, Cassandra, ElastiCache, and OpenSearch.
terraform/aws/live/dev/eu-central-1/database/main.tf
Kubernetes application plane
EKS add-ons, delivery controllers, and workloads.
- Shared Kubernetes resources
terraform/aws/live/dev/eu-central-1/eks-kubernetes-resources/main.tf - Argo CD · Manages Kubernetes application delivery.
terraform/aws/live/dev/eu-central-1/apps/argocd/main.tf - ALB Controller and Istio · Provides load-balancing and in-cluster traffic control.
terraform/aws/live/dev/eu-central-1/apps/alb-controller/main.tf - External Secrets · Supplies Hyperswitch workload secrets.
terraform/aws/live/dev/eu-central-1/apps/external-secrets-operator/main.tf - Hyperswitch services · Payments-switch application integration.
terraform/aws/live/dev/eu-central-1/apps/hyperswitch-app/main.tf
Edge and operations
Public delivery, observability, validation, and load testing.
- CloudFront edge · Public API, media, and web-app routing.
terraform/aws/live/dev/eu-central-1/cloudfront/main.tf - Vector, Loki, Grafana · Collects, stores, and visualizes logs.
terraform/aws/live/dev/eu-central-1/apps/vector/main.tf - Terraform CI validation · Validates Terraform and generates module docs.
.github/workflows/terraform-validate.yml - Locust load testing · Exercises deployed endpoints.
load-test/locustfile.py
Connections 22
- State backend bootstrap → Dev regional stacks: state foundation
- Dev regional stacks → VPC network composition: instantiates
- Dev regional stacks → EKS composition: instantiates
- Dev regional stacks → Hyperswitch module: instantiates
- VPC network composition → VPC and endpoints: provisions
- VPC and endpoints → Security rules: network boundary
- VPC and endpoints → EKS cluster: hosts
- Security rules → Jump host and proxy: controls access
- EKS composition → EKS cluster: provisions
- EKS cluster → Shared Kubernetes resources: hosts
- Shared Kubernetes resources → Argo CD: enables
- Shared Kubernetes resources → ALB Controller and Istio: enables
- Shared Kubernetes resources → External Secrets: enables
- Hyperswitch module → Hyperswitch services: deploys
- EKS cluster → Hyperswitch services: runs
- ALB Controller and Istio → Hyperswitch services: routes traffic
- External Secrets → Hyperswitch services: provides secrets
- Hyperswitch services → Data services: uses persistence and cache
- CloudFront edge → ALB Controller and Istio: public traffic
- Hyperswitch services → Vector, Loki, Grafana: emits logs
- Terraform CI validation → Dev regional stacks: validates
- Locust load testing → CloudFront edge: tests