# fathma/distributed-payment-platform architecture

> Architecture diagram of the GitHub repository fathma/distributed-payment-platform, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fathma/distributed-payment-platform
- Repository: https://github.com/fathma/distributed-payment-platform

## Overview

PayFlow is currently a NestJS service scaffold: the user-visible workflow is limited to health and readiness checks, not order creation or payment processing. Each service boots its own module; readiness controllers call health services that probe their configured dependencies. The README describes PostgreSQL, Redis, Kafka, and observability infrastructure, but the supplied excerpts do not show business routes, event processing, or monitoring wiring. The graph therefore reflects the implemented health workflow and its evidenced probes, not the planned payment lifecycle.

Main entry points: [`packages/config/src/index.ts`](https://github.com/fathma/distributed-payment-platform/blob/main/packages/config/src/index.ts) (Configuration), [`apps/order-service/src/health.service.ts`](https://github.com/fathma/distributed-payment-platform/blob/main/apps/order-service/src/health.service.ts) (Order health checks), [`apps/payment-service/src/health.service.ts`](https://github.com/fathma/distributed-payment-platform/blob/main/apps/payment-service/src/health.service.ts) (Payment health checks), [`apps/api-gateway/src/health.service.ts`](https://github.com/fathma/distributed-payment-platform/blob/main/apps/api-gateway/src/health.service.ts) (Gateway health checks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_services["NestJS services"]
  node_gateway_boot["Gateway bootstrap<br/>[main.ts]"]
  node_gateway_module["Gateway module<br/>[app.module.ts]"]
  node_gateway_controller["Gateway health routes"]
  node_gateway_health["Gateway health checks<br/>[health.service.ts]"]
  node_order_boot["Order bootstrap<br/>[main.ts]"]
  node_order_module["Order module<br/>[app.module.ts]"]
  node_order_controller["Order health routes"]
  node_order_health["Order health checks<br/>[health.service.ts]"]
  node_payment_boot["Payment bootstrap<br/>[main.ts]"]
  node_payment_module["Payment module<br/>[app.module.ts]"]
  node_payment_controller["Payment health routes"]
  node_payment_health["Payment health checks<br/>[health.service.ts]"]
  node_worker_boot["Worker bootstrap<br/>[main.ts]"]
  node_worker_module["Worker module<br/>[app.module.ts]"]
  node_worker_controller["Worker health routes"]
  node_worker_health["Worker health checks<br/>[health.service.ts]"]
end

subgraph group_shared["Shared runtime"]
  node_config["Configuration<br/>[index.ts]"]
end

subgraph group_dependencies["Runtime dependencies"]
  node_redis[("Redis")]
  node_order_db[("Order PostgreSQL")]
  node_payment_db[("Payment PostgreSQL")]
  node_kafka["Kafka cluster"]
end

node_caller(("Health caller"))

node_gateway_boot -->|"starts"| node_gateway_module
node_gateway_boot -->|"loads config"| node_config
node_gateway_module -->|"registers"| node_gateway_controller
node_gateway_module -->|"registers"| node_gateway_health
node_caller -->|"requests health"| node_gateway_controller
node_gateway_controller -->|"checks readiness"| node_gateway_health
node_gateway_health -->|"loads config"| node_config
node_gateway_health -->|"pings"| node_redis
node_order_boot -->|"starts"| node_order_module
node_order_boot -->|"loads config"| node_config
node_order_module -->|"registers"| node_order_controller
node_order_module -->|"registers"| node_order_health
node_caller -->|"requests health"| node_order_controller
node_order_controller -->|"checks readiness"| node_order_health
node_order_health -->|"loads config"| node_config
node_order_health -->|"probes"| node_order_db
node_order_health -->|"checks cluster"| node_kafka
node_payment_boot -->|"starts"| node_payment_module
node_payment_boot -->|"loads config"| node_config
node_payment_module -->|"registers"| node_payment_controller
node_payment_module -->|"registers"| node_payment_health
node_caller -->|"requests health"| node_payment_controller
node_payment_controller -->|"checks readiness"| node_payment_health
node_payment_health -->|"loads config"| node_config
node_payment_health -->|"probes"| node_payment_db
node_payment_health -->|"checks cluster"| node_kafka
node_worker_boot -->|"starts"| node_worker_module
node_worker_boot -->|"loads config"| node_config
node_worker_module -->|"registers"| node_worker_controller
node_worker_module -->|"registers"| node_worker_health
node_caller -->|"requests health"| node_worker_controller
node_worker_controller -->|"checks readiness"| node_worker_health
node_worker_health -->|"loads config"| node_config
node_worker_health -->|"checks cluster"| node_kafka

click node_gateway_boot "https://github.com/fathma/distributed-payment-platform/blob/main/apps/api-gateway/src/main.ts"
click node_gateway_module "https://github.com/fathma/distributed-payment-platform/blob/main/apps/api-gateway/src/app.module.ts"
click node_gateway_controller "https://github.com/fathma/distributed-payment-platform/blob/main/apps/api-gateway/src/health.controller.ts"
click node_gateway_health "https://github.com/fathma/distributed-payment-platform/blob/main/apps/api-gateway/src/health.service.ts"
click node_order_boot "https://github.com/fathma/distributed-payment-platform/blob/main/apps/order-service/src/main.ts"
click node_order_module "https://github.com/fathma/distributed-payment-platform/blob/main/apps/order-service/src/app.module.ts"
click node_order_controller "https://github.com/fathma/distributed-payment-platform/blob/main/apps/order-service/src/health.controller.ts"
click node_order_health "https://github.com/fathma/distributed-payment-platform/blob/main/apps/order-service/src/health.service.ts"
click node_payment_boot "https://github.com/fathma/distributed-payment-platform/blob/main/apps/payment-service/src/main.ts"
click node_payment_module "https://github.com/fathma/distributed-payment-platform/blob/main/apps/payment-service/src/app.module.ts"
click node_payment_controller "https://github.com/fathma/distributed-payment-platform/blob/main/apps/payment-service/src/health.controller.ts"
click node_payment_health "https://github.com/fathma/distributed-payment-platform/blob/main/apps/payment-service/src/health.service.ts"
click node_worker_boot "https://github.com/fathma/distributed-payment-platform/blob/main/apps/payment-worker/src/main.ts"
click node_worker_module "https://github.com/fathma/distributed-payment-platform/blob/main/apps/payment-worker/src/app.module.ts"
click node_worker_controller "https://github.com/fathma/distributed-payment-platform/blob/main/apps/payment-worker/src/health.controller.ts"
click node_worker_health "https://github.com/fathma/distributed-payment-platform/blob/main/apps/payment-worker/src/health.service.ts"
click node_config "https://github.com/fathma/distributed-payment-platform/blob/main/packages/config/src/index.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_gateway_boot,node_gateway_module,node_gateway_controller,node_gateway_health,node_order_boot,node_order_module,node_order_controller,node_order_health,node_payment_boot,node_payment_module,node_payment_controller,node_payment_health,node_worker_boot,node_worker_module,node_worker_controller,node_worker_health toneBlue
class node_config toneAmber
class node_redis,node_order_db,node_payment_db,node_kafka toneMint
class node_caller toneIndigo
```

## Components

### NestJS services

- [Gateway bootstrap](https://github.com/fathma/distributed-payment-platform/blob/main/apps/api-gateway/src/main.ts): `apps/api-gateway/src/main.ts`
- [Gateway module](https://github.com/fathma/distributed-payment-platform/blob/main/apps/api-gateway/src/app.module.ts): `apps/api-gateway/src/app.module.ts`
- [Gateway health routes](https://github.com/fathma/distributed-payment-platform/blob/main/apps/api-gateway/src/health.controller.ts): `apps/api-gateway/src/health.controller.ts`
- [Gateway health checks](https://github.com/fathma/distributed-payment-platform/blob/main/apps/api-gateway/src/health.service.ts): `apps/api-gateway/src/health.service.ts`
- [Order bootstrap](https://github.com/fathma/distributed-payment-platform/blob/main/apps/order-service/src/main.ts): `apps/order-service/src/main.ts`
- [Order module](https://github.com/fathma/distributed-payment-platform/blob/main/apps/order-service/src/app.module.ts): `apps/order-service/src/app.module.ts`
- [Order health routes](https://github.com/fathma/distributed-payment-platform/blob/main/apps/order-service/src/health.controller.ts): `apps/order-service/src/health.controller.ts`
- [Order health checks](https://github.com/fathma/distributed-payment-platform/blob/main/apps/order-service/src/health.service.ts): `apps/order-service/src/health.service.ts`
- [Payment bootstrap](https://github.com/fathma/distributed-payment-platform/blob/main/apps/payment-service/src/main.ts): `apps/payment-service/src/main.ts`
- [Payment module](https://github.com/fathma/distributed-payment-platform/blob/main/apps/payment-service/src/app.module.ts): `apps/payment-service/src/app.module.ts`
- [Payment health routes](https://github.com/fathma/distributed-payment-platform/blob/main/apps/payment-service/src/health.controller.ts): `apps/payment-service/src/health.controller.ts`
- [Payment health checks](https://github.com/fathma/distributed-payment-platform/blob/main/apps/payment-service/src/health.service.ts): `apps/payment-service/src/health.service.ts`
- [Worker bootstrap](https://github.com/fathma/distributed-payment-platform/blob/main/apps/payment-worker/src/main.ts): `apps/payment-worker/src/main.ts`
- [Worker module](https://github.com/fathma/distributed-payment-platform/blob/main/apps/payment-worker/src/app.module.ts): `apps/payment-worker/src/app.module.ts`
- [Worker health routes](https://github.com/fathma/distributed-payment-platform/blob/main/apps/payment-worker/src/health.controller.ts): `apps/payment-worker/src/health.controller.ts`
- [Worker health checks](https://github.com/fathma/distributed-payment-platform/blob/main/apps/payment-worker/src/health.service.ts): `apps/payment-worker/src/health.service.ts`

### Shared runtime

- [Configuration](https://github.com/fathma/distributed-payment-platform/blob/main/packages/config/src/index.ts): `packages/config/src/index.ts`

### Runtime dependencies

- **Redis**
- **Order PostgreSQL**
- **Payment PostgreSQL**
- **Kafka cluster**

### Other components

- **Health caller**

## Connections

- Gateway bootstrap → Gateway module: starts (evidence: `apps/api-gateway/src/main.ts`)
- Gateway bootstrap → Configuration: loads config (evidence: `apps/api-gateway/src/main.ts`)
- Gateway module → Gateway health routes: registers (evidence: `apps/api-gateway/src/app.module.ts`)
- Gateway module → Gateway health checks: registers (evidence: `apps/api-gateway/src/app.module.ts`)
- Health caller → Gateway health routes: requests health (evidence: `apps/api-gateway/src/health.controller.ts`)
- Gateway health routes → Gateway health checks: checks readiness (evidence: `apps/api-gateway/src/health.controller.ts`)
- Gateway health checks → Configuration: loads config (evidence: `apps/api-gateway/src/health.service.ts`)
- Gateway health checks → Redis: pings (evidence: `apps/api-gateway/src/health.service.ts`)
- Order bootstrap → Order module: starts (evidence: `apps/order-service/src/main.ts`)
- Order bootstrap → Configuration: loads config (evidence: `apps/order-service/src/main.ts`)
- Order module → Order health routes: registers (evidence: `apps/order-service/src/app.module.ts`)
- Order module → Order health checks: registers (evidence: `apps/order-service/src/app.module.ts`)
- Health caller → Order health routes: requests health (evidence: `apps/order-service/src/health.controller.ts`)
- Order health routes → Order health checks: checks readiness (evidence: `apps/order-service/src/health.controller.ts`)
- Order health checks → Configuration: loads config (evidence: `apps/order-service/src/health.service.ts`)
- Order health checks → Order PostgreSQL: probes (evidence: `apps/order-service/src/health.service.ts`)
- Order health checks → Kafka cluster: checks cluster (evidence: `apps/order-service/src/health.service.ts`)
- Payment bootstrap → Payment module: starts (evidence: `apps/payment-service/src/main.ts`)
- Payment bootstrap → Configuration: loads config (evidence: `apps/payment-service/src/main.ts`)
- Payment module → Payment health routes: registers (evidence: `apps/payment-service/src/app.module.ts`)
- Payment module → Payment health checks: registers (evidence: `apps/payment-service/src/app.module.ts`)
- Health caller → Payment health routes: requests health (evidence: `apps/payment-service/src/health.controller.ts`)
- Payment health routes → Payment health checks: checks readiness (evidence: `apps/payment-service/src/health.controller.ts`)
- Payment health checks → Configuration: loads config (evidence: `apps/payment-service/src/health.service.ts`)
- Payment health checks → Payment PostgreSQL: probes (evidence: `apps/payment-service/src/health.service.ts`)
- Payment health checks → Kafka cluster: checks cluster (evidence: `apps/payment-service/src/health.service.ts`)
- Worker bootstrap → Worker module: starts (evidence: `apps/payment-worker/src/main.ts`)
- Worker bootstrap → Configuration: loads config (evidence: `apps/payment-worker/src/main.ts`)
- Worker module → Worker health routes: registers (evidence: `apps/payment-worker/src/app.module.ts`)
- Worker module → Worker health checks: registers (evidence: `apps/payment-worker/src/app.module.ts`)
- Health caller → Worker health routes: requests health (evidence: `apps/payment-worker/src/health.controller.ts`)
- Worker health routes → Worker health checks: checks readiness (evidence: `apps/payment-worker/src/health.controller.ts`)
- Worker health checks → Configuration: loads config (evidence: `apps/payment-worker/src/health.service.ts`)
- Worker health checks → Kafka cluster: checks cluster (evidence: `apps/payment-worker/src/health.service.ts`)
