# heromontage/headphones-blockchain architecture

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

- Interactive diagram: https://gitdiagram.com/heromontage/headphones-blockchain
- Repository: https://github.com/heromontage/headphones-blockchain

## Overview

Aether Audio is a headphone storefront with authenticated ordering and blockchain-based AETHER Points rewards. The main customer journey is browsing the product, getting an ETH-denominated quote, creating an order, paying from a wallet, and verifying payment; successful verification can mint rewards. Customers can also check balances, redeem points, manage profiles, and review orders. Admins have a separate order-management flow. The tree and README establish the broader UI capabilities, but unsampled page implementations leave some UI-to-API wiring uncertain.

Main entry points: [`src/app/api/auth/[...nextauth]/route.ts`](https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/auth/%5B...nextauth%5D/route.ts) (Authentication), [`src/lib/db.ts`](https://github.com/heromontage/headphones-blockchain/blob/main/src/lib/db.ts) (MySQL data), [`src/app/order/page.tsx`](https://github.com/heromontage/headphones-blockchain/blob/main/src/app/order/page.tsx) (Order page), [`src/app/api/orders/route.ts`](https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/orders/route.ts) (Create order)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_storefront["Storefront"]
  node_home["Storefront<br/>[page.tsx]"]
  node_specs["Product specs<br/>[page.tsx]"]
  node_orderui["Order page<br/>[page.tsx]"]
  node_success["Order success<br/>[page.tsx]"]
  node_profile["Customer profile<br/>[page.tsx]"]
  node_adminui["Order admin<br/>[page.tsx]"]
  node_authui["Sign-in UI<br/>[AuthModal.tsx]"]
  node_walletui["Wallet UI"]
  node_rewardsui["Rewards dashboard"]
end

subgraph group_commerce["Orders and payments"]
  node_quote["Price quote<br/>[route.ts]"]
  node_orders["Create order<br/>[route.ts]"]
  node_orderlookup["Order lookup<br/>[route.ts]"]
  node_verify["Payment verification<br/>[route.ts]"]
  node_adminorders["Admin orders API<br/>[route.ts]"]
  node_status["Order status API<br/>[route.ts]"]
end

subgraph group_identity["Identity and accounts"]
  node_auth["Authentication<br/>[route.ts]"]
  node_signup["Signup<br/>[route.ts]"]
  node_address["Shipping address<br/>[route.ts]"]
end

subgraph group_loyalty["Blockchain rewards"]
  node_userpoints["User points<br/>[route.ts]"]
  node_walletapi["Wallet account<br/>[route.ts]"]
  node_balance["Reward balance<br/>[route.ts]"]
  node_mint["Mint points<br/>[route.ts]"]
  node_redeem["Redeem points<br/>[route.ts]"]
end

node_customer(("Customer"))
node_admin(("Admin"))
node_db[("MySQL data<br/>[db.ts]")]
node_chain{{"Token contract"}}
node_wallet(("Customer wallet"))
node_ethrate["ETH price service"]

node_customer -->|"browses"| node_home
node_home -->|"views details"| node_specs
node_customer -->|"starts purchase"| node_orderui
node_orderui -.->|"requests quote"| node_quote
node_orderui -.->|"creates order"| node_orders
node_quote -->|"fetches rate"| node_ethrate
node_orders -->|"fetches rate"| node_ethrate
node_orders -->|"reads and writes"| node_db
node_orders -->|"checks session"| node_auth
node_orderui -.->|"pays"| node_wallet
node_customer -->|"connects wallet"| node_walletui
node_verify -->|"checks session"| node_auth
node_verify -->|"checks and updates"| node_db
node_verify -->|"verifies payment; mints"| node_chain
node_wallet -->|"submits payment"| node_chain
node_success -.->|"loads order"| node_orderlookup
node_success -.->|"submits transaction"| node_verify
node_success -.->|"requests points"| node_mint
node_mint -->|"checks session"| node_auth
node_mint -->|"reads and updates"| node_db
node_mint -->|"mints tokens"| node_chain
node_profile -.->|"manages address"| node_address
node_profile -.->|"manages wallet"| node_walletapi
node_profile -.->|"loads points"| node_userpoints
node_rewardsui -.->|"checks balance"| node_balance
node_rewardsui -.->|"redeems points"| node_redeem
node_balance -->|"checks session"| node_auth
node_balance -->|"reads wallet"| node_db
node_balance -->|"reads balance"| node_chain
node_redeem -->|"checks session"| node_auth
node_redeem -->|"reads and updates"| node_db
node_redeem -->|"burns tokens"| node_chain
node_authui -.->|"signs in"| node_auth
node_auth -->|"reads and writes"| node_db
node_signup -->|"creates account"| node_db
node_admin -->|"manages orders"| node_adminui
node_adminui -.->|"lists orders"| node_adminorders
node_adminui -.->|"updates status"| node_status
node_adminorders -->|"checks session"| node_auth
node_adminorders -->|"reads orders"| node_db
node_status -->|"checks session"| node_auth
node_status -->|"updates order"| node_db

click node_home "https://github.com/heromontage/headphones-blockchain/blob/main/src/app/page.tsx"
click node_specs "https://github.com/heromontage/headphones-blockchain/blob/main/src/app/specs/page.tsx"
click node_orderui "https://github.com/heromontage/headphones-blockchain/blob/main/src/app/order/page.tsx"
click node_success "https://github.com/heromontage/headphones-blockchain/blob/main/src/app/order-success/page.tsx"
click node_profile "https://github.com/heromontage/headphones-blockchain/blob/main/src/app/profile/page.tsx"
click node_adminui "https://github.com/heromontage/headphones-blockchain/blob/main/src/app/admin/orders/page.tsx"
click node_authui "https://github.com/heromontage/headphones-blockchain/blob/main/src/components/AuthModal.tsx"
click node_walletui "https://github.com/heromontage/headphones-blockchain/blob/main/src/components/WalletConnection.tsx"
click node_rewardsui "https://github.com/heromontage/headphones-blockchain/blob/main/src/components/RewardsDashboard.tsx"
click node_auth "https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/auth/%5B...nextauth%5D/route.ts"
click node_signup "https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/auth/signup/route.ts"
click node_address "https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/user/address/route.ts"
click node_userpoints "https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/user/points/route.ts"
click node_walletapi "https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/user/wallet/route.ts"
click node_quote "https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/orders/quote/route.ts"
click node_orders "https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/orders/route.ts"
click node_orderlookup "https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/orders/%5Bid%5D/route.ts"
click node_verify "https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/orders/%5Bid%5D/verify-payment/route.ts"
click node_adminorders "https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/admin/orders/route.ts"
click node_status "https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/admin/orders/%5Bid%5D/status/route.ts"
click node_balance "https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/rewards/get-balance/route.ts"
click node_mint "https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/rewards/mint-points/route.ts"
click node_redeem "https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/rewards/redeem-points/route.ts"
click node_db "https://github.com/heromontage/headphones-blockchain/blob/main/src/lib/db.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_home,node_specs,node_orderui,node_success,node_profile,node_adminui,node_authui,node_walletui,node_rewardsui toneBlue
class node_quote,node_orders,node_orderlookup,node_verify,node_adminorders,node_status,node_db toneAmber
class node_auth,node_signup,node_address toneMint
class node_userpoints,node_walletapi,node_balance,node_mint,node_redeem toneRose
class node_customer,node_admin,node_chain,node_wallet,node_ethrate toneIndigo
```

## Components

### Storefront

- [Storefront](https://github.com/heromontage/headphones-blockchain/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [Product specs](https://github.com/heromontage/headphones-blockchain/blob/main/src/app/specs/page.tsx): `src/app/specs/page.tsx`
- [Order page](https://github.com/heromontage/headphones-blockchain/blob/main/src/app/order/page.tsx): `src/app/order/page.tsx`
- [Order success](https://github.com/heromontage/headphones-blockchain/blob/main/src/app/order-success/page.tsx): `src/app/order-success/page.tsx`
- [Customer profile](https://github.com/heromontage/headphones-blockchain/blob/main/src/app/profile/page.tsx): `src/app/profile/page.tsx`
- [Order admin](https://github.com/heromontage/headphones-blockchain/blob/main/src/app/admin/orders/page.tsx): `src/app/admin/orders/page.tsx`
- [Sign-in UI](https://github.com/heromontage/headphones-blockchain/blob/main/src/components/AuthModal.tsx): `src/components/AuthModal.tsx`
- [Wallet UI](https://github.com/heromontage/headphones-blockchain/blob/main/src/components/WalletConnection.tsx): `src/components/WalletConnection.tsx`
- [Rewards dashboard](https://github.com/heromontage/headphones-blockchain/blob/main/src/components/RewardsDashboard.tsx): `src/components/RewardsDashboard.tsx`

### Orders and payments

- [Price quote](https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/orders/quote/route.ts): `src/app/api/orders/quote/route.ts`
- [Create order](https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/orders/route.ts): `src/app/api/orders/route.ts`
- [Order lookup](https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/orders/%5Bid%5D/route.ts): `src/app/api/orders/[id]/route.ts`
- [Payment verification](https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/orders/%5Bid%5D/verify-payment/route.ts): `src/app/api/orders/[id]/verify-payment/route.ts`
- [Admin orders API](https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/admin/orders/route.ts): `src/app/api/admin/orders/route.ts`
- [Order status API](https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/admin/orders/%5Bid%5D/status/route.ts): `src/app/api/admin/orders/[id]/status/route.ts`

### Identity and accounts

- [Authentication](https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/auth/%5B...nextauth%5D/route.ts): `src/app/api/auth/[...nextauth]/route.ts`
- [Signup](https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/auth/signup/route.ts): `src/app/api/auth/signup/route.ts`
- [Shipping address](https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/user/address/route.ts): `src/app/api/user/address/route.ts`

### Blockchain rewards

- [User points](https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/user/points/route.ts): `src/app/api/user/points/route.ts`
- [Wallet account](https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/user/wallet/route.ts): `src/app/api/user/wallet/route.ts`
- [Reward balance](https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/rewards/get-balance/route.ts): `src/app/api/rewards/get-balance/route.ts`
- [Mint points](https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/rewards/mint-points/route.ts): `src/app/api/rewards/mint-points/route.ts`
- [Redeem points](https://github.com/heromontage/headphones-blockchain/blob/main/src/app/api/rewards/redeem-points/route.ts): `src/app/api/rewards/redeem-points/route.ts`

### Other components

- **Customer**
- **Admin**
- [MySQL data](https://github.com/heromontage/headphones-blockchain/blob/main/src/lib/db.ts): `src/lib/db.ts`
- **Token contract**
- **Customer wallet**
- **ETH price service**

## Connections

- Customer → Storefront: browses
- Storefront → Product specs: views details
- Customer → Order page: starts purchase
- Order page → Price quote: requests quote
- Order page → Create order: creates order
- Price quote → ETH price service: fetches rate
- Create order → ETH price service: fetches rate
- Create order → MySQL data: reads and writes
- Create order → Authentication: checks session
- Order page → Customer wallet: pays
- Customer → Wallet UI: connects wallet
- Payment verification → Authentication: checks session
- Payment verification → MySQL data: checks and updates
- Payment verification → Token contract: verifies payment; mints
- Customer wallet → Token contract: submits payment
- Order success → Order lookup: loads order
- Order success → Payment verification: submits transaction
- Order success → Mint points: requests points
- Mint points → Authentication: checks session
- Mint points → MySQL data: reads and updates
- Mint points → Token contract: mints tokens
- Customer profile → Shipping address: manages address
- Customer profile → Wallet account: manages wallet
- Customer profile → User points: loads points
- Rewards dashboard → Reward balance: checks balance
- Rewards dashboard → Redeem points: redeems points
- Reward balance → Authentication: checks session
- Reward balance → MySQL data: reads wallet
- Reward balance → Token contract: reads balance
- Redeem points → Authentication: checks session
- Redeem points → MySQL data: reads and updates
- Redeem points → Token contract: burns tokens
- Sign-in UI → Authentication: signs in
- Authentication → MySQL data: reads and writes
- Signup → MySQL data: creates account
- Admin → Order admin: manages orders
- Order admin → Admin orders API: lists orders
- Order admin → Order status API: updates status
- Admin orders API → Authentication: checks session
- Admin orders API → MySQL data: reads orders
- Order status API → Authentication: checks session
- Order status API → MySQL data: updates order
