# theanamsaqib/craft-chain architecture

> Architecture diagram of the GitHub repository theanamsaqib/craft-chain, 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/theanamsaqib/craft-chain
- Repository: https://github.com/theanamsaqib/craft-chain

## Overview

Craft-Chain is a handmade-batch provenance app: users create batches, record journey updates, and transfer ownership; anyone can look up a batch and view its history. The frontend coordinates wallet-based contract reads and writes, while a server route pins JSON metadata through Pinata. The source excerpts show the tracking queries and contract interactions, but do not expose the full creation or update handlers. The contract source and README were not provided, so those details and links are limited to the evidence available.

Main entry points: [`frontend/src/app/page.js`](https://github.com/theanamsaqib/craft-chain/blob/main/frontend/src/app/page.js) (Batch app), [`contracts/contracts/CraftBatch721.sol`](https://github.com/theanamsaqib/craft-chain/blob/main/contracts/contracts/CraftBatch721.sol) (Batch ERC-721), [`frontend/src/app/api/pin/route.js`](https://github.com/theanamsaqib/craft-chain/blob/main/frontend/src/app/api/pin/route.js) (Pin API), [`frontend/src/app/Icons.js`](https://github.com/theanamsaqib/craft-chain/blob/main/frontend/src/app/Icons.js) (UI icons)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_frontend["Web app"]
  node_app["Batch app<br/>[page.js]"]
  node_icons["UI icons<br/>[Icons.js]"]
  node_batch_view["Journey display<br/>[BatchView.js]"]
end

subgraph group_chain["On-chain provenance"]
  node_contract["Batch ERC-721<br/>[CraftBatch721.sol]"]
end

subgraph group_metadata["Metadata storage"]
  node_pin_route["Pin API<br/>[route.js]"]
end

node_user(("Batch participant"))
node_public_viewer(("Public viewer"))
node_pinata["Pinata"]
node_sepolia[("Sepolia chain")]

node_user -->|"uses"| node_app
node_public_viewer -->|"tracks batches"| node_app
node_app -->|"renders"| node_icons
node_app -->|"renders"| node_batch_view
node_app -->|"reads and writes"| node_contract
node_contract -.->|"deployed on"| node_sepolia
node_user -.->|"submits metadata"| node_pin_route
node_pin_route -->|"pins JSON"| node_pinata

click node_app "https://github.com/theanamsaqib/craft-chain/blob/main/frontend/src/app/page.js"
click node_icons "https://github.com/theanamsaqib/craft-chain/blob/main/frontend/src/app/Icons.js"
click node_batch_view "https://github.com/theanamsaqib/craft-chain/blob/main/frontend/src/app/BatchView.js"
click node_pin_route "https://github.com/theanamsaqib/craft-chain/blob/main/frontend/src/app/api/pin/route.js"
click node_contract "https://github.com/theanamsaqib/craft-chain/blob/main/contracts/contracts/CraftBatch721.sol"

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_icons,node_batch_view,node_public_viewer toneBlue
class node_contract,node_sepolia toneAmber
class node_pin_route toneMint
class node_user,node_pinata toneIndigo
```

## Components

### Web app

- [Batch app](https://github.com/theanamsaqib/craft-chain/blob/main/frontend/src/app/page.js): `frontend/src/app/page.js`
- [UI icons](https://github.com/theanamsaqib/craft-chain/blob/main/frontend/src/app/Icons.js): `frontend/src/app/Icons.js`
- [Journey display](https://github.com/theanamsaqib/craft-chain/blob/main/frontend/src/app/BatchView.js): `frontend/src/app/BatchView.js`

### On-chain provenance

- [Batch ERC-721](https://github.com/theanamsaqib/craft-chain/blob/main/contracts/contracts/CraftBatch721.sol): `contracts/contracts/CraftBatch721.sol`

### Metadata storage

- [Pin API](https://github.com/theanamsaqib/craft-chain/blob/main/frontend/src/app/api/pin/route.js): `frontend/src/app/api/pin/route.js`

### Other components

- **Batch participant**
- **Public viewer**
- **Pinata**
- **Sepolia chain**

## Connections

- Batch participant → Batch app: uses (evidence: `frontend/src/app/page.js`)
- Public viewer → Batch app: tracks batches (evidence: `frontend/src/app/page.js`)
- Batch app → UI icons: renders (evidence: `frontend/src/app/page.js`)
- Batch app → Journey display: renders (evidence: `frontend/src/app/page.js`)
- Batch app → Batch ERC-721: reads and writes (evidence: `frontend/src/app/page.js`)
- Batch ERC-721 → Sepolia chain: deployed on
- Batch participant → Pin API: submits metadata
- Pin API → Pinata: pins JSON (evidence: `frontend/src/app/api/pin/route.js`)
