# jhaycrypt001/tender architecture

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

- Interactive diagram: https://gitdiagram.com/jhaycrypt001/tender
- Repository: https://github.com/jhaycrypt001/tender

## Overview

Tender is an any-chain crypto checkout: a buyer pays from a supported chain and the merchant receives settlement on Monad. The intended flow spans invoice creation, deposit detection, settlement, and merchant-facing status or webhook delivery; the README notes that the web app is built while the API is still in progress. The graph reflects the routes and integrations visible in the tree and excerpts; some route-to-service wiring and unsampled frontend screens are therefore not expanded.

Main entry points: [`backend/src/app.ts`](https://github.com/jhaycrypt001/tender/blob/main/backend/src/app.ts) (HTTP app), [`backend/src/worker.ts`](https://github.com/jhaycrypt001/tender/blob/main/backend/src/worker.ts) (Background worker), [`backend/src/workers/poller.ts`](https://github.com/jhaycrypt001/tender/blob/main/backend/src/workers/poller.ts) (Deposit poller), [`frontend/src/lib/api/client.ts`](https://github.com/jhaycrypt001/tender/blob/main/frontend/src/lib/api/client.ts) (API client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_checkout["Checkout page<br/>[page.tsx]"]
  node_pay_ui["Checkout UI<br/>[checkout.tsx]"]
  node_dashboard["Merchant dashboard<br/>[page.tsx]"]
  node_dash_features["Dashboard features<br/>[page.tsx]"]
  node_web_api["API client<br/>[client.ts]"]
end

subgraph group_api["Merchant API"]
  node_app["HTTP app<br/>[app.ts]"]
  node_public_routes["Public routes<br/>[public.ts]"]
  node_invoice_routes["Invoice routes<br/>[invoices.ts]"]
  node_payment_routes["Payment routes<br/>[payments.ts]"]
  node_merchant_routes["Merchant routes<br/>[merchants.ts]"]
end

subgraph group_payments["Payment processing"]
  node_invoice_service["Invoice service<br/>[invoice.service.ts]"]
  node_settlement["Settlement processing<br/>[settlement.ts]"]
  node_proof["Settlement proofs"]
  node_poller["Deposit poller<br/>[poller.ts]"]
  node_aurora_client["Aurora client<br/>[client.ts]"]
end

subgraph group_state["State and delivery"]
  node_db[("Postgres<br/>[client.ts]")]
  node_redis[("Redis<br/>[server.ts]")]
  node_webhook_worker["Webhook worker<br/>[webhook.worker.ts]"]
  node_webhook_service["Webhook sender<br/>[webhook.service.ts]"]
  node_worker["Background worker<br/>[worker.ts]"]
end

node_buyer(("Buyer"))
node_merchant(("Merchant"))
node_aurora{{"Aurora"}}
node_chains{{"Payment chains"}}
node_merchant_hook{{"Merchant webhook"}}

node_buyer -->|"opens checkout"| node_checkout
node_checkout -->|"renders"| node_pay_ui
node_pay_ui -->|"requests invoice"| node_web_api
node_merchant -->|"uses dashboard"| node_dashboard
node_dashboard -->|"requests data"| node_web_api
node_dash_features -->|"requests data"| node_web_api
node_web_api -->|"HTTP requests"| node_app
node_app -->|"registers"| node_public_routes
node_app -->|"registers"| node_invoice_routes
node_app -->|"registers"| node_payment_routes
node_app -->|"registers"| node_merchant_routes
node_invoice_service -->|"reads and writes"| node_db
node_invoice_service -->|"mints addresses"| node_aurora_client
node_worker -->|"starts polling"| node_poller
node_worker -->|"starts loop"| node_webhook_worker
node_worker -->|"queries merchant"| node_db
node_worker -->|"stores catalogue"| node_redis
node_poller -->|"reads and updates"| node_db
node_poller -->|"checks deposits"| node_aurora_client
node_poller -->|"processes deposits"| node_settlement
node_settlement -->|"verifies settlement"| node_proof
node_aurora_client -->|"calls API"| node_aurora
node_aurora -->|"tracks deposits"| node_chains
node_webhook_worker -->|"claims and updates"| node_db
node_webhook_worker -->|"sends delivery"| node_webhook_service
node_webhook_service -->|"delivers event"| node_merchant_hook

click node_checkout "https://github.com/jhaycrypt001/tender/blob/main/frontend/src/app/pay/%5Btoken%5D/page.tsx"
click node_pay_ui "https://github.com/jhaycrypt001/tender/blob/main/frontend/src/components/pay/checkout.tsx"
click node_dashboard "https://github.com/jhaycrypt001/tender/blob/main/frontend/src/app/app/(dash)/home/page.tsx"
click node_dash_features "https://github.com/jhaycrypt001/tender/blob/main/frontend/src/app/app/(dash)/pay/payout/page.tsx"
click node_web_api "https://github.com/jhaycrypt001/tender/blob/main/frontend/src/lib/api/client.ts"
click node_app "https://github.com/jhaycrypt001/tender/blob/main/backend/src/app.ts"
click node_public_routes "https://github.com/jhaycrypt001/tender/blob/main/backend/src/routes/public.ts"
click node_invoice_routes "https://github.com/jhaycrypt001/tender/blob/main/backend/src/routes/invoices.ts"
click node_payment_routes "https://github.com/jhaycrypt001/tender/blob/main/backend/src/routes/payments.ts"
click node_merchant_routes "https://github.com/jhaycrypt001/tender/blob/main/backend/src/routes/merchants.ts"
click node_invoice_service "https://github.com/jhaycrypt001/tender/blob/main/backend/src/services/invoice.service.ts"
click node_settlement "https://github.com/jhaycrypt001/tender/blob/main/backend/src/services/settlement.ts"
click node_proof "https://github.com/jhaycrypt001/tender/blob/main/backend/src/services/settlement-proof.service.ts"
click node_poller "https://github.com/jhaycrypt001/tender/blob/main/backend/src/workers/poller.ts"
click node_aurora_client "https://github.com/jhaycrypt001/tender/blob/main/backend/src/aurora/client.ts"
click node_db "https://github.com/jhaycrypt001/tender/blob/main/backend/src/db/client.ts"
click node_redis "https://github.com/jhaycrypt001/tender/blob/main/backend/src/server.ts"
click node_webhook_worker "https://github.com/jhaycrypt001/tender/blob/main/backend/src/workers/webhook.worker.ts"
click node_webhook_service "https://github.com/jhaycrypt001/tender/blob/main/backend/src/services/webhook.service.ts"
click node_worker "https://github.com/jhaycrypt001/tender/blob/main/backend/src/worker.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_checkout,node_pay_ui,node_dashboard,node_dash_features,node_web_api toneBlue
class node_app,node_public_routes,node_invoice_routes,node_payment_routes,node_merchant_routes toneAmber
class node_invoice_service,node_settlement,node_proof,node_poller,node_aurora_client,node_merchant_hook toneMint
class node_db,node_redis,node_webhook_worker,node_webhook_service,node_worker toneRose
class node_buyer,node_merchant,node_aurora,node_chains toneIndigo
```

## Components

### Web experience

- [Checkout page](https://github.com/jhaycrypt001/tender/blob/main/frontend/src/app/pay/%5Btoken%5D/page.tsx): `frontend/src/app/pay/[token]/page.tsx`
- [Checkout UI](https://github.com/jhaycrypt001/tender/blob/main/frontend/src/components/pay/checkout.tsx): `frontend/src/components/pay/checkout.tsx`
- [Merchant dashboard](https://github.com/jhaycrypt001/tender/blob/main/frontend/src/app/app/(dash)/home/page.tsx): `frontend/src/app/app/(dash)/home/page.tsx`
- [Dashboard features](https://github.com/jhaycrypt001/tender/blob/main/frontend/src/app/app/(dash)/pay/payout/page.tsx): `frontend/src/app/app/(dash)/pay/payout/page.tsx`
- [API client](https://github.com/jhaycrypt001/tender/blob/main/frontend/src/lib/api/client.ts): `frontend/src/lib/api/client.ts`

### Merchant API

- [HTTP app](https://github.com/jhaycrypt001/tender/blob/main/backend/src/app.ts): `backend/src/app.ts`
- [Public routes](https://github.com/jhaycrypt001/tender/blob/main/backend/src/routes/public.ts): `backend/src/routes/public.ts`
- [Invoice routes](https://github.com/jhaycrypt001/tender/blob/main/backend/src/routes/invoices.ts): `backend/src/routes/invoices.ts`
- [Payment routes](https://github.com/jhaycrypt001/tender/blob/main/backend/src/routes/payments.ts): `backend/src/routes/payments.ts`
- [Merchant routes](https://github.com/jhaycrypt001/tender/blob/main/backend/src/routes/merchants.ts): `backend/src/routes/merchants.ts`

### Payment processing

- [Invoice service](https://github.com/jhaycrypt001/tender/blob/main/backend/src/services/invoice.service.ts): `backend/src/services/invoice.service.ts`
- [Settlement processing](https://github.com/jhaycrypt001/tender/blob/main/backend/src/services/settlement.ts): `backend/src/services/settlement.ts`
- [Settlement proofs](https://github.com/jhaycrypt001/tender/blob/main/backend/src/services/settlement-proof.service.ts): `backend/src/services/settlement-proof.service.ts`
- [Deposit poller](https://github.com/jhaycrypt001/tender/blob/main/backend/src/workers/poller.ts): `backend/src/workers/poller.ts`
- [Aurora client](https://github.com/jhaycrypt001/tender/blob/main/backend/src/aurora/client.ts): `backend/src/aurora/client.ts`

### State and delivery

- [Postgres](https://github.com/jhaycrypt001/tender/blob/main/backend/src/db/client.ts): `backend/src/db/client.ts`
- [Redis](https://github.com/jhaycrypt001/tender/blob/main/backend/src/server.ts): `backend/src/server.ts`
- [Webhook worker](https://github.com/jhaycrypt001/tender/blob/main/backend/src/workers/webhook.worker.ts): `backend/src/workers/webhook.worker.ts`
- [Webhook sender](https://github.com/jhaycrypt001/tender/blob/main/backend/src/services/webhook.service.ts): `backend/src/services/webhook.service.ts`
- [Background worker](https://github.com/jhaycrypt001/tender/blob/main/backend/src/worker.ts): `backend/src/worker.ts`

### Other components

- **Buyer**
- **Merchant**
- **Aurora**
- **Payment chains**
- **Merchant webhook**

## Connections

- Buyer → Checkout page: opens checkout
- Checkout page → Checkout UI: renders
- Checkout UI → API client: requests invoice
- Merchant → Merchant dashboard: uses dashboard
- Merchant dashboard → API client: requests data
- Dashboard features → API client: requests data
- API client → HTTP app: HTTP requests
- HTTP app → Public routes: registers
- HTTP app → Invoice routes: registers
- HTTP app → Payment routes: registers
- HTTP app → Merchant routes: registers
- Invoice service → Postgres: reads and writes
- Invoice service → Aurora client: mints addresses
- Background worker → Deposit poller: starts polling
- Background worker → Webhook worker: starts loop
- Background worker → Postgres: queries merchant
- Background worker → Redis: stores catalogue
- Deposit poller → Postgres: reads and updates
- Deposit poller → Aurora client: checks deposits
- Deposit poller → Settlement processing: processes deposits
- Settlement processing → Settlement proofs: verifies settlement
- Aurora client → Aurora: calls API
- Aurora → Payment chains: tracks deposits
- Webhook worker → Postgres: claims and updates
- Webhook worker → Webhook sender: sends delivery
- Webhook sender → Merchant webhook: delivers event
