# serpenthedeceiver/zyro-frontend architecture

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

- Interactive diagram: https://gitdiagram.com/serpenthedeceiver/zyro-frontend
- Repository: https://github.com/serpenthedeceiver/zyro-frontend

## Overview

Zyro is a React frontend for a trust-focused second-hand marketplace. A buyer signs in by phone OTP, discovers a listing, contacts its seller, and can proceed through order and escrow tracking; sellers can create listings and manage their profiles. The UI routes these tasks through a selectable mock/live API layer, with listing images uploaded directly to Supabase Storage. The README documents local Spring services behind an API gateway, but those services are not in this repository. Several domain screens are documented but their implementation details were not sampled.

Main entry points: [`src/main.jsx`](https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/main.jsx) (Page routing), [`src/api/index.js`](https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/api/index.js) (API mode selector), [`src/pages/ProfilePage.jsx`](https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/pages/ProfilePage.jsx) (Profile and listings), [`src/context/AuthContext.jsx`](https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/context/AuthContext.jsx) (Session and profile)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Application"]
  node_routes["Page routing<br/>[main.jsx]"]
end

subgraph group_identity["Identity and seller access"]
  node_authpage["OTP sign-in<br/>[AuthPage.jsx]"]
  node_authstate["Session and profile<br/>[AuthContext.jsx]"]
  node_seller["Seller access"]
  node_kyc["KYC flow<br/>[KYCPage.jsx]"]
  node_profile["Profile and listings<br/>[ProfilePage.jsx]"]
  node_preferences["Settings and notices<br/>[SettingsPage.jsx]"]
end

subgraph group_market["Marketplace"]
  node_browse["Listing discovery<br/>[HomePage.jsx]"]
  node_search["Product search"]
  node_product["Product details"]
  node_listing["Create listing"]
  node_upload["Image upload<br/>[useImageUpload.js]"]
  node_chat["Buyer-seller chat<br/>[ChatPage.jsx]"]
  node_chatstate["Chat operations<br/>[useChat.js]"]
end

subgraph group_transactions["Transactions"]
  node_orders["Order views<br/>[OrdersPage.jsx]"]
  node_orderdetail["Escrow order detail"]
  node_wallet["Wallet activity<br/>[WalletPage.jsx]"]
end

subgraph group_foundation["API and state"]
  node_api["API mode selector<br/>[index.js]"]
  node_client["HTTP client<br/>[client.js]"]
  node_localstate["Shared local state<br/>[useLocalStorage.js]"]
end

node_user(("Marketplace user"))
node_gateway{{"Spring API gateway"}}
node_storage[("Supabase Storage")]
node_phoneauth{{"Supabase Phone Auth"}}

node_user -->|"uses"| node_routes
node_routes -->|"routes to"| node_authpage
node_routes -->|"routes to"| node_browse
node_routes -->|"routes to"| node_search
node_routes -->|"routes to"| node_product
node_routes -->|"routes to"| node_listing
node_routes -->|"routes to"| node_chat
node_routes -->|"routes to"| node_orders
node_routes -->|"routes to"| node_orderdetail
node_routes -->|"routes to"| node_wallet
node_routes -->|"routes to"| node_profile
node_routes -->|"routes to"| node_preferences
node_routes -->|"routes to"| node_kyc
node_authpage -->|"requests OTP"| node_authstate
node_authstate -->|"uses auth API"| node_api
node_seller -->|"checks access"| node_authstate
node_listing -->|"uploads images"| node_upload
node_upload -.->|"stores images"| node_storage
node_chat -->|"uses chat hook"| node_chatstate
node_chatstate -->|"uses chat API"| node_api
node_orders -->|"loads orders"| node_api
node_orderdetail -->|"loads order"| node_api
node_wallet -->|"loads wallet"| node_api
node_profile -->|"updates profile"| node_authstate
node_profile -->|"loads listings"| node_api
node_browse -->|"loads products"| node_api
node_search -->|"loads products"| node_api
node_product -->|"uses marketplace API"| node_api
node_listing -->|"publishes listing"| node_api
node_api -->|"selects live API"| node_client
node_client -->|"sends HTTP"| node_gateway
node_api -.->|"supports OTP auth"| node_phoneauth
node_profile -.->|"shares UI state"| node_localstate

click node_routes "https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/main.jsx"
click node_authpage "https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/pages/AuthPage.jsx"
click node_authstate "https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/context/AuthContext.jsx"
click node_seller "https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/routes/VerifiedSellerRoute.jsx"
click node_kyc "https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/pages/KYCPage.jsx"
click node_browse "https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/pages/HomePage.jsx"
click node_search "https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/pages/ProductListPage.jsx"
click node_product "https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/pages/ProductDetailPage.jsx"
click node_listing "https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/pages/CreateListingPage.jsx"
click node_upload "https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/hooks/useImageUpload.js"
click node_chat "https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/pages/ChatPage.jsx"
click node_chatstate "https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/hooks/useChat.js"
click node_orders "https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/pages/OrdersPage.jsx"
click node_orderdetail "https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/pages/OrderDetailPage.jsx"
click node_wallet "https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/pages/WalletPage.jsx"
click node_profile "https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/pages/ProfilePage.jsx"
click node_preferences "https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/pages/SettingsPage.jsx"
click node_api "https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/api/index.js"
click node_client "https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/api/client.js"
click node_localstate "https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/hooks/useLocalStorage.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_routes,node_user toneBlue
class node_authpage,node_authstate,node_seller,node_kyc,node_profile,node_preferences,node_storage toneAmber
class node_browse,node_search,node_product,node_listing,node_upload,node_chat,node_chatstate,node_gateway toneMint
class node_orders,node_orderdetail,node_wallet toneRose
class node_api,node_client,node_localstate,node_phoneauth toneIndigo
```

## Components

### Application

- [Page routing](https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/main.jsx): `src/main.jsx`

### Identity and seller access

- [OTP sign-in](https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/pages/AuthPage.jsx): `src/pages/AuthPage.jsx`
- [Session and profile](https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/context/AuthContext.jsx): `src/context/AuthContext.jsx`
- [Seller access](https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/routes/VerifiedSellerRoute.jsx): `src/routes/VerifiedSellerRoute.jsx`
- [KYC flow](https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/pages/KYCPage.jsx): `src/pages/KYCPage.jsx`
- [Profile and listings](https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/pages/ProfilePage.jsx): `src/pages/ProfilePage.jsx`
- [Settings and notices](https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/pages/SettingsPage.jsx): `src/pages/SettingsPage.jsx`

### Marketplace

- [Listing discovery](https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/pages/HomePage.jsx): `src/pages/HomePage.jsx`
- [Product search](https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/pages/ProductListPage.jsx): `src/pages/ProductListPage.jsx`
- [Product details](https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/pages/ProductDetailPage.jsx): `src/pages/ProductDetailPage.jsx`
- [Create listing](https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/pages/CreateListingPage.jsx): `src/pages/CreateListingPage.jsx`
- [Image upload](https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/hooks/useImageUpload.js): `src/hooks/useImageUpload.js`
- [Buyer-seller chat](https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/pages/ChatPage.jsx): `src/pages/ChatPage.jsx`
- [Chat operations](https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/hooks/useChat.js): `src/hooks/useChat.js`

### Transactions

- [Order views](https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/pages/OrdersPage.jsx): `src/pages/OrdersPage.jsx`
- [Escrow order detail](https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/pages/OrderDetailPage.jsx): `src/pages/OrderDetailPage.jsx`
- [Wallet activity](https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/pages/WalletPage.jsx): `src/pages/WalletPage.jsx`

### API and state

- [API mode selector](https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/api/index.js): `src/api/index.js`
- [HTTP client](https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/api/client.js): `src/api/client.js`
- [Shared local state](https://github.com/serpenthedeceiver/zyro-frontend/blob/main/src/hooks/useLocalStorage.js): `src/hooks/useLocalStorage.js`

### Other components

- **Marketplace user**
- **Spring API gateway**
- **Supabase Storage**
- **Supabase Phone Auth**

## Connections

- Marketplace user → Page routing: uses (evidence: `src/main.jsx`)
- Page routing → OTP sign-in: routes to (evidence: `src/main.jsx`)
- Page routing → Listing discovery: routes to (evidence: `src/main.jsx`)
- Page routing → Product search: routes to (evidence: `src/main.jsx`)
- Page routing → Product details: routes to (evidence: `src/main.jsx`)
- Page routing → Create listing: routes to (evidence: `src/main.jsx`)
- Page routing → Buyer-seller chat: routes to (evidence: `src/main.jsx`)
- Page routing → Order views: routes to (evidence: `src/main.jsx`)
- Page routing → Escrow order detail: routes to (evidence: `src/main.jsx`)
- Page routing → Wallet activity: routes to (evidence: `src/main.jsx`)
- Page routing → Profile and listings: routes to (evidence: `src/main.jsx`)
- Page routing → Settings and notices: routes to (evidence: `src/main.jsx`)
- Page routing → KYC flow: routes to (evidence: `src/main.jsx`)
- OTP sign-in → Session and profile: requests OTP (evidence: `src/pages/AuthPage.jsx`)
- Session and profile → API mode selector: uses auth API (evidence: `src/context/AuthContext.jsx`)
- Seller access → Session and profile: checks access (evidence: `src/routes/VerifiedSellerRoute.jsx`)
- Create listing → Image upload: uploads images (evidence: `src/pages/CreateListingPage.jsx`)
- Image upload → Supabase Storage: stores images (evidence: `README.md`)
- Buyer-seller chat → Chat operations: uses chat hook (evidence: `src/pages/ChatPage.jsx`)
- Chat operations → API mode selector: uses chat API (evidence: `src/hooks/useChat.js`)
- Order views → API mode selector: loads orders (evidence: `src/pages/OrdersPage.jsx`)
- Escrow order detail → API mode selector: loads order (evidence: `src/pages/OrderDetailPage.jsx`)
- Wallet activity → API mode selector: loads wallet (evidence: `src/pages/WalletPage.jsx`)
- Profile and listings → Session and profile: updates profile (evidence: `src/pages/ProfilePage.jsx`)
- Profile and listings → API mode selector: loads listings (evidence: `src/pages/ProfilePage.jsx`)
- Listing discovery → API mode selector: loads products (evidence: `src/pages/HomePage.jsx`)
- Product search → API mode selector: loads products (evidence: `src/pages/ProductListPage.jsx`)
- Product details → API mode selector: uses marketplace API (evidence: `src/pages/ProductDetailPage.jsx`)
- Create listing → API mode selector: publishes listing (evidence: `src/pages/CreateListingPage.jsx`)
- API mode selector → HTTP client: selects live API (evidence: `src/api/index.js`)
- HTTP client → Spring API gateway: sends HTTP (evidence: `README.md`)
- API mode selector → Supabase Phone Auth: supports OTP auth (evidence: `README.md`)
- Profile and listings → Shared local state: shares UI state (evidence: `src/pages/ProfilePage.jsx`)
