# benjamin-future/fairtrade-chain architecture

> Architecture diagram of the GitHub repository benjamin-future/fairtrade-chain, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-22). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/benjamin-future/fairtrade-chain
- Repository: https://github.com/benjamin-future/fairtrade-chain

## Overview

FairTrace is a blockchain-backed fair-trade supply-chain tracker. Users browse batches and open a batch record; participants connect a wallet in the dashboard to register participants, record harvest and handling stages, transfers, wages and audits. The contract holds records and computes verification, which the frontend presents with wage, journey and audit details. README describes only a generic Hardhat sample, so domain capabilities here are supported by the sampled frontend and deployment script. The contract implementation was not excerpted; its behavior and its internal calls are therefore not mapped.

Main entry points: [`frontend/src/contract.js`](https://github.com/benjamin-future/fairtrade-chain/blob/main/frontend/src/contract.js) (Contract client), [`frontend/src/router.js`](https://github.com/benjamin-future/fairtrade-chain/blob/main/frontend/src/router.js) (Page routes), [`frontend/src/App.vue`](https://github.com/benjamin-future/fairtrade-chain/blob/main/frontend/src/App.vue) (App shell), [`frontend/src/views/HomeView.vue`](https://github.com/benjamin-future/fairtrade-chain/blob/main/frontend/src/views/HomeView.vue) (Batch browser)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["FairTrace frontend"]
  node_app["App shell<br/>[App.vue]"]
  node_routes["Page routes<br/>[router.js]"]
  node_browse["Batch browser<br/>[HomeView.vue]"]
  node_batch["Batch record<br/>[BatchView.vue]"]
  node_dashboard["Participant dashboard<br/>[DashboardView.vue]"]
  node_chainclient["Contract client<br/>[contract.js]"]
end

subgraph group_chain["Supply-chain records"]
  node_contract[("Supply-chain contract")]
  node_deployment["Deployment metadata<br/>[sepolia.json]"]
  node_demo["Demo data seeding<br/>[deploy.js]"]
end

node_visitor(("Browser user"))
node_wallet["MetaMask wallet"]
node_rpc["Ethereum RPC"]

node_visitor -->|"opens"| node_app
node_app -->|"renders"| node_routes
node_routes -->|"routes to"| node_browse
node_routes -->|"routes to"| node_batch
node_routes -->|"routes to"| node_dashboard
node_browse -->|"reads records"| node_chainclient
node_batch -->|"reads records"| node_chainclient
node_dashboard -->|"reads and writes"| node_chainclient
node_chainclient -->|"loads ABI"| node_deployment
node_chainclient -->|"reads via"| node_rpc
node_chainclient -->|"requests signing"| node_wallet
node_chainclient -->|"calls"| node_contract
node_demo -->|"seeds records"| node_contract

click node_app "https://github.com/benjamin-future/fairtrade-chain/blob/main/frontend/src/App.vue"
click node_routes "https://github.com/benjamin-future/fairtrade-chain/blob/main/frontend/src/router.js"
click node_browse "https://github.com/benjamin-future/fairtrade-chain/blob/main/frontend/src/views/HomeView.vue"
click node_batch "https://github.com/benjamin-future/fairtrade-chain/blob/main/frontend/src/views/BatchView.vue"
click node_dashboard "https://github.com/benjamin-future/fairtrade-chain/blob/main/frontend/src/views/DashboardView.vue"
click node_chainclient "https://github.com/benjamin-future/fairtrade-chain/blob/main/frontend/src/contract.js"
click node_contract "https://github.com/benjamin-future/fairtrade-chain/blob/main/contracts/FairTradeSupplyChain.sol"
click node_deployment "https://github.com/benjamin-future/fairtrade-chain/blob/main/deployments/sepolia.json"
click node_demo "https://github.com/benjamin-future/fairtrade-chain/blob/main/scripts/deploy.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_app,node_routes,node_browse,node_batch,node_dashboard,node_chainclient,node_visitor toneBlue
class node_contract,node_deployment,node_demo toneAmber
class node_wallet,node_rpc toneIndigo
```

## Components

### FairTrace frontend

- [App shell](https://github.com/benjamin-future/fairtrade-chain/blob/main/frontend/src/App.vue): `frontend/src/App.vue`
- [Page routes](https://github.com/benjamin-future/fairtrade-chain/blob/main/frontend/src/router.js): `frontend/src/router.js`
- [Batch browser](https://github.com/benjamin-future/fairtrade-chain/blob/main/frontend/src/views/HomeView.vue): `frontend/src/views/HomeView.vue`
- [Batch record](https://github.com/benjamin-future/fairtrade-chain/blob/main/frontend/src/views/BatchView.vue): `frontend/src/views/BatchView.vue`
- [Participant dashboard](https://github.com/benjamin-future/fairtrade-chain/blob/main/frontend/src/views/DashboardView.vue): `frontend/src/views/DashboardView.vue`
- [Contract client](https://github.com/benjamin-future/fairtrade-chain/blob/main/frontend/src/contract.js): `frontend/src/contract.js`

### Supply-chain records

- [Supply-chain contract](https://github.com/benjamin-future/fairtrade-chain/blob/main/contracts/FairTradeSupplyChain.sol): `contracts/FairTradeSupplyChain.sol`
- [Deployment metadata](https://github.com/benjamin-future/fairtrade-chain/blob/main/deployments/sepolia.json): `deployments/sepolia.json`
- [Demo data seeding](https://github.com/benjamin-future/fairtrade-chain/blob/main/scripts/deploy.js): `scripts/deploy.js`

### Other components

- **Browser user**
- **MetaMask wallet**
- **Ethereum RPC**

## Connections

- Browser user → App shell: opens (evidence: `frontend/src/App.vue`)
- App shell → Page routes: renders (evidence: `frontend/src/router.js`)
- Page routes → Batch browser: routes to (evidence: `frontend/src/router.js`)
- Page routes → Batch record: routes to (evidence: `frontend/src/router.js`)
- Page routes → Participant dashboard: routes to (evidence: `frontend/src/router.js`)
- Batch browser → Contract client: reads records (evidence: `frontend/src/views/HomeView.vue`)
- Batch record → Contract client: reads records (evidence: `frontend/src/views/BatchView.vue`)
- Participant dashboard → Contract client: reads and writes (evidence: `frontend/src/views/DashboardView.vue`)
- Contract client → Deployment metadata: loads ABI (evidence: `frontend/src/contract.js`)
- Contract client → Ethereum RPC: reads via (evidence: `frontend/src/contract.js`)
- Contract client → MetaMask wallet: requests signing (evidence: `frontend/src/contract.js`)
- Contract client → Supply-chain contract: calls (evidence: `frontend/src/contract.js`)
- Demo data seeding → Supply-chain contract: seeds records (evidence: `scripts/deploy.js`)
