# nirobahsanx/cbpay-open-amount architecture

> Architecture diagram of the GitHub repository nirobahsanx/cbpay-open-amount, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-10). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/nirobahsanx/cbpay-open-amount
- Repository: https://github.com/nirobahsanx/cbpay-open-amount

## Overview

CBPay Open-Amount Payment Page lets a customer enter an amount and request a USDT checkout. The Express server validates the amount, creates an idempotency key, and sends a checkout request to CBPay; it returns the checkout URL to the browser. The API key stays server-side. The page source is listed in the tree but was not excerpted, so its specific submission behavior is supported only by the README; health-check behavior is visible in server.js.

Main entry points: [`server.js`](https://github.com/nirobahsanx/cbpay-open-amount/blob/main/server.js) (Checkout handler), [`public/index.html`](https://github.com/nirobahsanx/cbpay-open-amount/blob/main/public/index.html) (Payment page)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_customer_flow["Customer checkout"]
  node_payment_page["Payment page<br/>[index.html]"]
end

subgraph group_server_runtime["Server runtime"]
  node_checkout_handler["Checkout handler<br/>[server.js]"]
  node_health_check["Health check<br/>[server.js]"]
end

node_customer(("Customer"))
node_cbpay["CBPay API"]

node_customer -->|"enters amount"| node_payment_page
node_payment_page -->|"requests checkout"| node_checkout_handler
node_checkout_handler -->|"creates payin"| node_cbpay
node_checkout_handler -->|"returns checkout URL"| node_payment_page

click node_payment_page "https://github.com/nirobahsanx/cbpay-open-amount/blob/main/public/index.html"
click node_checkout_handler "https://github.com/nirobahsanx/cbpay-open-amount/blob/main/server.js"
click node_health_check "https://github.com/nirobahsanx/cbpay-open-amount/blob/main/server.js"

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_payment_page toneBlue
class node_checkout_handler,node_health_check toneAmber
class node_customer toneIndigo
class node_cbpay toneMint
```

## Components

### Customer checkout

- [Payment page](https://github.com/nirobahsanx/cbpay-open-amount/blob/main/public/index.html): `public/index.html`

### Server runtime

- [Checkout handler](https://github.com/nirobahsanx/cbpay-open-amount/blob/main/server.js): `server.js`
- [Health check](https://github.com/nirobahsanx/cbpay-open-amount/blob/main/server.js): `server.js`

### Other components

- **Customer**
- **CBPay API**

## Connections

- Customer → Payment page: enters amount (evidence: `README.md`)
- Payment page → Checkout handler: requests checkout (evidence: `README.md`)
- Checkout handler → CBPay API: creates payin (evidence: `server.js`)
- Checkout handler → Payment page: returns checkout URL (evidence: `server.js`)
