# fz-hazem/equa architecture

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

- Interactive diagram: https://gitdiagram.com/fz-hazem/equa
- Repository: https://github.com/fz-hazem/equa

## Overview

EQUA is a web platform for wallet-based payments and conditional on-chain escrow, with KYC and a backend API. The main user flow runs from the web app to API operations for transfers or escrow, with blockchain and database services supporting backend work; wallet interactions are also a documented frontend capability. The README documents REST, database, and chain integrations. Some frontend pages and backend domains are represented from the tree, but their detailed calls were not sampled, so those links are omitted where unsupported.

Main entry points: [`apps/backend/src/prisma/prisma.service.ts`](https://github.com/fz-hazem/equa/blob/main/apps/backend/src/prisma/prisma.service.ts) (PostgreSQL data), [`apps/frontend/src/app/dashboard/page.tsx`](https://github.com/fz-hazem/equa/blob/main/apps/frontend/src/app/dashboard/page.tsx) (EQUA web app), [`apps/backend/src/app.module.ts`](https://github.com/fz-hazem/equa/blob/main/apps/backend/src/app.module.ts) (Backend API), [`apps/backend/src/escrow/escrow.service.ts`](https://github.com/fz-hazem/equa/blob/main/apps/backend/src/escrow/escrow.service.ts) (Escrow service)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_webapp["EQUA web app<br/>[page.tsx]"]
  node_landing["Product landing<br/>[page.tsx]"]
  node_dashboard["Activity dashboard"]
  node_transfer_ui["Transfer dialog<br/>[TransferModal.tsx]"]
  node_escrow_ui["Escrow dialog<br/>[EscrowModal.tsx]"]
  node_transactions["Transaction history<br/>[page.tsx]"]
end

subgraph group_identity["Identity and compliance"]
  node_login["Login screen<br/>[page.tsx]"]
  node_auth["Account registration<br/>[auth.service.ts]"]
  node_kyc_ui["KYC onboarding<br/>[page.tsx]"]
  node_kyc["KYC verification<br/>[kyc.service.ts]"]
  node_kyc_guard["KYC access guard<br/>[kyc.guard.ts]"]
end

subgraph group_payments["Payment operations"]
  node_transfers["P2P transfer service"]
  node_payment["Transfer validation<br/>[payment.service.ts]"]
  node_invoice["Invoice service<br/>[invoice.service.ts]"]
  node_escrow["Escrow service<br/>[escrow.service.ts]"]
end

subgraph group_platform["Backend platform"]
  node_api["Backend API<br/>[app.module.ts]"]
  node_database[("PostgreSQL data<br/>[prisma.service.ts]")]
  node_indexer["Web3 event indexer"]
end

subgraph group_chain["Blockchain access"]
  node_chain_access["Blockchain service"]
end

node_user(("User and wallet"))
node_blockchain[("Polygon chain")]

node_user -->|"uses"| node_webapp
node_webapp -->|"REST requests"| node_api
node_webapp -->|"wallet access"| node_blockchain
node_webapp -->|"opens"| node_transfer_ui
node_webapp -->|"opens"| node_escrow_ui
node_landing -->|"presents"| node_webapp
node_api -->|"registers"| node_dashboard
node_transfer_ui -.->|"submits"| node_transfers
node_escrow_ui -.->|"submits"| node_escrow
node_transfers -->|"executes transfer"| node_chain_access
node_escrow -->|"creates escrow"| node_chain_access
node_chain_access -->|"RPC access"| node_blockchain
node_transfers -->|"reads and creates users"| node_database
node_escrow -.->|"uses persistence"| node_database
node_auth -->|"reads and creates users"| node_database
node_kyc -->|"uses persistence"| node_database
node_payment -->|"uses persistence"| node_database
node_invoice -->|"uses persistence"| node_database
node_indexer -->|"stores indexed data"| node_database
node_kyc_guard -->|"checks KYC"| node_database
node_api -->|"registers"| node_transfers
node_api -->|"registers"| node_escrow
node_api -->|"registers"| node_chain_access
node_escrow -->|"locks funds"| node_blockchain
node_blockchain -->|"emits events"| node_indexer

click node_webapp "https://github.com/fz-hazem/equa/blob/main/apps/frontend/src/app/dashboard/page.tsx"
click node_landing "https://github.com/fz-hazem/equa/blob/main/apps/frontend/src/app/page.tsx"
click node_dashboard "https://github.com/fz-hazem/equa/blob/main/apps/backend/src/dashboard/dashboard.controller.ts"
click node_transfer_ui "https://github.com/fz-hazem/equa/blob/main/apps/frontend/src/components/TransferModal.tsx"
click node_escrow_ui "https://github.com/fz-hazem/equa/blob/main/apps/frontend/src/components/EscrowModal.tsx"
click node_transactions "https://github.com/fz-hazem/equa/blob/main/apps/frontend/src/app/transactions/page.tsx"
click node_login "https://github.com/fz-hazem/equa/blob/main/apps/frontend/src/app/login/page.tsx"
click node_auth "https://github.com/fz-hazem/equa/blob/main/apps/backend/src/modules/auth/auth.service.ts"
click node_kyc_ui "https://github.com/fz-hazem/equa/blob/main/apps/frontend/src/app/kyc/page.tsx"
click node_kyc "https://github.com/fz-hazem/equa/blob/main/apps/backend/src/modules/kyc/kyc.service.ts"
click node_kyc_guard "https://github.com/fz-hazem/equa/blob/main/apps/backend/src/common/guards/kyc.guard.ts"
click node_transfers "https://github.com/fz-hazem/equa/blob/main/apps/backend/src/transfers/transfers.service.ts"
click node_payment "https://github.com/fz-hazem/equa/blob/main/apps/backend/src/modules/payment/payment.service.ts"
click node_invoice "https://github.com/fz-hazem/equa/blob/main/apps/backend/src/modules/invoice/invoice.service.ts"
click node_escrow "https://github.com/fz-hazem/equa/blob/main/apps/backend/src/escrow/escrow.service.ts"
click node_api "https://github.com/fz-hazem/equa/blob/main/apps/backend/src/app.module.ts"
click node_database "https://github.com/fz-hazem/equa/blob/main/apps/backend/src/prisma/prisma.service.ts"
click node_indexer "https://github.com/fz-hazem/equa/blob/main/apps/backend/src/modules/web3-indexer/web3-indexer.service.ts"
click node_chain_access "https://github.com/fz-hazem/equa/blob/main/apps/backend/src/blockchain/blockchain.service.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_webapp,node_landing,node_dashboard,node_transfer_ui,node_escrow_ui,node_transactions,node_user toneBlue
class node_login,node_auth,node_kyc_ui,node_kyc,node_kyc_guard,node_blockchain toneAmber
class node_transfers,node_payment,node_invoice,node_escrow toneMint
class node_api,node_database,node_indexer toneRose
class node_chain_access toneIndigo
```

## Components

### Web application

- [EQUA web app](https://github.com/fz-hazem/equa/blob/main/apps/frontend/src/app/dashboard/page.tsx): `apps/frontend/src/app/dashboard/page.tsx`
- [Product landing](https://github.com/fz-hazem/equa/blob/main/apps/frontend/src/app/page.tsx): `apps/frontend/src/app/page.tsx`
- [Activity dashboard](https://github.com/fz-hazem/equa/blob/main/apps/backend/src/dashboard/dashboard.controller.ts): `apps/backend/src/dashboard/dashboard.controller.ts`
- [Transfer dialog](https://github.com/fz-hazem/equa/blob/main/apps/frontend/src/components/TransferModal.tsx): `apps/frontend/src/components/TransferModal.tsx`
- [Escrow dialog](https://github.com/fz-hazem/equa/blob/main/apps/frontend/src/components/EscrowModal.tsx): `apps/frontend/src/components/EscrowModal.tsx`
- [Transaction history](https://github.com/fz-hazem/equa/blob/main/apps/frontend/src/app/transactions/page.tsx): `apps/frontend/src/app/transactions/page.tsx`

### Identity and compliance

- [Login screen](https://github.com/fz-hazem/equa/blob/main/apps/frontend/src/app/login/page.tsx): `apps/frontend/src/app/login/page.tsx`
- [Account registration](https://github.com/fz-hazem/equa/blob/main/apps/backend/src/modules/auth/auth.service.ts): `apps/backend/src/modules/auth/auth.service.ts`
- [KYC onboarding](https://github.com/fz-hazem/equa/blob/main/apps/frontend/src/app/kyc/page.tsx): `apps/frontend/src/app/kyc/page.tsx`
- [KYC verification](https://github.com/fz-hazem/equa/blob/main/apps/backend/src/modules/kyc/kyc.service.ts): `apps/backend/src/modules/kyc/kyc.service.ts`
- [KYC access guard](https://github.com/fz-hazem/equa/blob/main/apps/backend/src/common/guards/kyc.guard.ts): `apps/backend/src/common/guards/kyc.guard.ts`

### Payment operations

- [P2P transfer service](https://github.com/fz-hazem/equa/blob/main/apps/backend/src/transfers/transfers.service.ts): `apps/backend/src/transfers/transfers.service.ts`
- [Transfer validation](https://github.com/fz-hazem/equa/blob/main/apps/backend/src/modules/payment/payment.service.ts): `apps/backend/src/modules/payment/payment.service.ts`
- [Invoice service](https://github.com/fz-hazem/equa/blob/main/apps/backend/src/modules/invoice/invoice.service.ts): `apps/backend/src/modules/invoice/invoice.service.ts`
- [Escrow service](https://github.com/fz-hazem/equa/blob/main/apps/backend/src/escrow/escrow.service.ts): `apps/backend/src/escrow/escrow.service.ts`

### Backend platform

- [Backend API](https://github.com/fz-hazem/equa/blob/main/apps/backend/src/app.module.ts): `apps/backend/src/app.module.ts`
- [PostgreSQL data](https://github.com/fz-hazem/equa/blob/main/apps/backend/src/prisma/prisma.service.ts): `apps/backend/src/prisma/prisma.service.ts`
- [Web3 event indexer](https://github.com/fz-hazem/equa/blob/main/apps/backend/src/modules/web3-indexer/web3-indexer.service.ts): `apps/backend/src/modules/web3-indexer/web3-indexer.service.ts`

### Blockchain access

- [Blockchain service](https://github.com/fz-hazem/equa/blob/main/apps/backend/src/blockchain/blockchain.service.ts): `apps/backend/src/blockchain/blockchain.service.ts`

### Other components

- **User and wallet**
- **Polygon chain**

## Connections

- User and wallet → EQUA web app: uses (evidence: `README.md`)
- EQUA web app → Backend API: REST requests (evidence: `README.md`)
- EQUA web app → Polygon chain: wallet access (evidence: `README.md`)
- EQUA web app → Transfer dialog: opens (evidence: `apps/frontend/src/app/dashboard/page.tsx`)
- EQUA web app → Escrow dialog: opens (evidence: `apps/frontend/src/app/dashboard/page.tsx`)
- Product landing → EQUA web app: presents (evidence: `apps/frontend/src/app/page.tsx`)
- Backend API → Activity dashboard: registers (evidence: `apps/backend/src/app.module.ts`)
- Transfer dialog → P2P transfer service: submits
- Escrow dialog → Escrow service: submits
- P2P transfer service → Blockchain service: executes transfer (evidence: `apps/backend/src/transfers/transfers.service.ts`)
- Escrow service → Blockchain service: creates escrow (evidence: `apps/backend/src/escrow/escrow.service.ts`)
- Blockchain service → Polygon chain: RPC access (evidence: `README.md`)
- P2P transfer service → PostgreSQL data: reads and creates users (evidence: `apps/backend/src/transfers/transfers.service.ts`)
- Escrow service → PostgreSQL data: uses persistence (evidence: `apps/backend/src/escrow/escrow.service.ts`)
- Account registration → PostgreSQL data: reads and creates users (evidence: `apps/backend/src/modules/auth/auth.service.ts`)
- KYC verification → PostgreSQL data: uses persistence (evidence: `apps/backend/src/modules/kyc/kyc.service.ts`)
- Transfer validation → PostgreSQL data: uses persistence (evidence: `apps/backend/src/modules/payment/payment.service.ts`)
- Invoice service → PostgreSQL data: uses persistence (evidence: `apps/backend/src/modules/invoice/invoice.service.ts`)
- Web3 event indexer → PostgreSQL data: stores indexed data (evidence: `apps/backend/src/modules/web3-indexer/web3-indexer.service.ts`)
- KYC access guard → PostgreSQL data: checks KYC (evidence: `apps/backend/src/common/guards/kyc.guard.ts`)
- Backend API → P2P transfer service: registers (evidence: `apps/backend/src/app.module.ts`)
- Backend API → Escrow service: registers (evidence: `apps/backend/src/app.module.ts`)
- Backend API → Blockchain service: registers (evidence: `apps/backend/src/app.module.ts`)
- Escrow service → Polygon chain: locks funds (evidence: `README.md`)
- Polygon chain → Web3 event indexer: emits events (evidence: `README.md`)
