# xalhexi-sch/uma-market architecture

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

- Interactive diagram: https://gitdiagram.com/xalhexi-sch/uma-market
- Repository: https://github.com/xalhexi-sch/uma-market

## Overview

UMA Market is a regional B2B farm-produce marketplace. Businesses discover local listings, build a multi-farm cart, check out, and track orders; farmers manage produce and fulfill incoming orders, while admins oversee platform records. The graph includes documented onboarding, messaging, and authentication integration. Some routes and query modules are unsampled, so uncertain internal wiring is omitted; search and product-form links are supported by the provided source excerpts.

Main entry points: [`src/app/(dashboard)/farmer/products/actions.ts`](https://github.com/xalhexi-sch/uma-market/blob/main/src/app/(dashboard)/farmer/products/actions.ts) (Produce Inventory), [`src/app/onboarding/actions.ts`](https://github.com/xalhexi-sch/uma-market/blob/main/src/app/onboarding/actions.ts) (Role Onboarding), [`src/lib/supabase/server.ts`](https://github.com/xalhexi-sch/uma-market/blob/main/src/lib/supabase/server.ts) (RLS Server Client), [`src/app/products/page.tsx`](https://github.com/xalhexi-sch/uma-market/blob/main/src/app/products/page.tsx) (Public Catalog)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_discovery["Marketplace Discovery"]
  node_public_catalog["Public Catalog<br/>[page.tsx]"]
  node_product_detail["Product Details<br/>[page.tsx]"]
  node_search_ui["Live Search UI"]
  node_search_api["Search API<br/>[route.ts]"]
  node_home["Marketplace Home<br/>[page.tsx]"]
end

subgraph group_buying["Business Purchasing"]
  node_business_cart["Grouped Cart<br/>[page.tsx]"]
  node_checkout["B2B Checkout<br/>[actions.ts]"]
  node_business_orders["Order History And Tracking<br/>[page.tsx]"]
end

subgraph group_supply["Farmer Operations"]
  node_farmer_products["Produce Inventory<br/>[actions.ts]"]
  node_product_form["Listing Form<br/>[product-form.tsx]"]
  node_farmer_orders["Incoming Orders<br/>[page.tsx]"]
  node_messages["Participant Messaging<br/>[actions.ts]"]
end

subgraph group_platform["Identity And Administration"]
  node_onboarding["Role Onboarding<br/>[actions.ts]"]
  node_auth{{"Clerk Identity"}}
  node_clerk_webhook["Identity Sync Webhook<br/>[route.ts]"]
  node_admin_console["Admin Workspaces<br/>[actions.ts]"]
end

subgraph group_data["Data Services"]
  node_product_queries["Product Queries<br/>[products.ts]"]
  node_orders_queries["Order Queries<br/>[orders.ts]"]
  node_profiles_queries["Profile Queries<br/>[profiles.ts]"]
  node_supabase_server["RLS Server Client<br/>[server.ts]"]
  node_database[("Supabase PostgreSQL")]
end

node_business(("Business Buyer"))
node_farmer(("Farmer"))
node_admin(("Administrator"))
node_clerk_service{{"Clerk Service"}}

node_business -->|"visits"| node_home
node_business -->|"browses"| node_public_catalog
node_public_catalog -->|"hosts search"| node_search_ui
node_search_ui -->|"fetches results"| node_search_api
node_search_api -->|"calls search"| node_product_queries
node_product_queries -->|"queries listings"| node_database
node_business -->|"inspects produce"| node_product_detail
node_business -->|"shops"| node_business_cart
node_business -->|"submits purchase"| node_checkout
node_business -->|"tracks orders"| node_business_orders
node_farmer -->|"manages listings"| node_farmer_products
node_farmer_products -->|"uses form"| node_product_form
node_product_form -->|"calls actions"| node_farmer_products
node_farmer -->|"manages fulfillment"| node_farmer_orders
node_farmer -->|"communicates"| node_messages
node_business -->|"communicates"| node_messages
node_business -->|"completes onboarding"| node_onboarding
node_farmer -->|"completes onboarding"| node_onboarding
node_admin -->|"administers platform"| node_admin_console
node_onboarding -->|"assigns role"| node_auth
node_auth -->|"authenticates"| node_clerk_service
node_clerk_service -->|"sends events"| node_clerk_webhook
node_clerk_webhook -->|"syncs profiles"| node_database
node_supabase_server -->|"gets session token"| node_auth
node_supabase_server -->|"connects with RLS"| node_database

click node_public_catalog "https://github.com/xalhexi-sch/uma-market/blob/main/src/app/products/page.tsx"
click node_product_detail "https://github.com/xalhexi-sch/uma-market/blob/main/src/app/products/%5Bid%5D/page.tsx"
click node_search_ui "https://github.com/xalhexi-sch/uma-market/blob/main/src/components/products/product-search-context.tsx"
click node_search_api "https://github.com/xalhexi-sch/uma-market/blob/main/src/app/api/products/search/route.ts"
click node_home "https://github.com/xalhexi-sch/uma-market/blob/main/src/app/page.tsx"
click node_business_cart "https://github.com/xalhexi-sch/uma-market/blob/main/src/app/(dashboard)/business/cart/page.tsx"
click node_checkout "https://github.com/xalhexi-sch/uma-market/blob/main/src/app/(dashboard)/business/checkout/actions.ts"
click node_business_orders "https://github.com/xalhexi-sch/uma-market/blob/main/src/app/(dashboard)/business/orders/page.tsx"
click node_farmer_products "https://github.com/xalhexi-sch/uma-market/blob/main/src/app/(dashboard)/farmer/products/actions.ts"
click node_product_form "https://github.com/xalhexi-sch/uma-market/blob/main/src/components/dashboard/product-form.tsx"
click node_farmer_orders "https://github.com/xalhexi-sch/uma-market/blob/main/src/app/(dashboard)/farmer/orders/page.tsx"
click node_messages "https://github.com/xalhexi-sch/uma-market/blob/main/src/app/(dashboard)/messages/actions.ts"
click node_onboarding "https://github.com/xalhexi-sch/uma-market/blob/main/src/app/onboarding/actions.ts"
click node_clerk_webhook "https://github.com/xalhexi-sch/uma-market/blob/main/src/app/api/webhooks/clerk/route.ts"
click node_admin_console "https://github.com/xalhexi-sch/uma-market/blob/main/src/app/(dashboard)/admin/actions.ts"
click node_product_queries "https://github.com/xalhexi-sch/uma-market/blob/main/src/lib/supabase/queries/products.ts"
click node_orders_queries "https://github.com/xalhexi-sch/uma-market/blob/main/src/lib/supabase/queries/orders.ts"
click node_profiles_queries "https://github.com/xalhexi-sch/uma-market/blob/main/src/lib/supabase/queries/profiles.ts"
click node_supabase_server "https://github.com/xalhexi-sch/uma-market/blob/main/src/lib/supabase/server.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_public_catalog,node_product_detail,node_search_ui,node_search_api,node_home toneBlue
class node_business_cart,node_checkout,node_business_orders toneAmber
class node_farmer_products,node_product_form,node_farmer_orders,node_messages toneMint
class node_onboarding,node_auth,node_clerk_webhook,node_admin_console toneRose
class node_product_queries,node_orders_queries,node_profiles_queries,node_supabase_server,node_database,node_business,node_farmer,node_admin,node_clerk_service toneIndigo
```

## Components

### Marketplace Discovery

- [Public Catalog](https://github.com/xalhexi-sch/uma-market/blob/main/src/app/products/page.tsx): `src/app/products/page.tsx`
- [Product Details](https://github.com/xalhexi-sch/uma-market/blob/main/src/app/products/%5Bid%5D/page.tsx): `src/app/products/[id]/page.tsx`
- [Live Search UI](https://github.com/xalhexi-sch/uma-market/blob/main/src/components/products/product-search-context.tsx): `src/components/products/product-search-context.tsx`
- [Search API](https://github.com/xalhexi-sch/uma-market/blob/main/src/app/api/products/search/route.ts): `src/app/api/products/search/route.ts`
- [Marketplace Home](https://github.com/xalhexi-sch/uma-market/blob/main/src/app/page.tsx): `src/app/page.tsx`

### Business Purchasing

- [Grouped Cart](https://github.com/xalhexi-sch/uma-market/blob/main/src/app/(dashboard)/business/cart/page.tsx): `src/app/(dashboard)/business/cart/page.tsx`
- [B2B Checkout](https://github.com/xalhexi-sch/uma-market/blob/main/src/app/(dashboard)/business/checkout/actions.ts): `src/app/(dashboard)/business/checkout/actions.ts`
- [Order History And Tracking](https://github.com/xalhexi-sch/uma-market/blob/main/src/app/(dashboard)/business/orders/page.tsx): `src/app/(dashboard)/business/orders/page.tsx`

### Farmer Operations

- [Produce Inventory](https://github.com/xalhexi-sch/uma-market/blob/main/src/app/(dashboard)/farmer/products/actions.ts): `src/app/(dashboard)/farmer/products/actions.ts`
- [Listing Form](https://github.com/xalhexi-sch/uma-market/blob/main/src/components/dashboard/product-form.tsx): `src/components/dashboard/product-form.tsx`
- [Incoming Orders](https://github.com/xalhexi-sch/uma-market/blob/main/src/app/(dashboard)/farmer/orders/page.tsx): `src/app/(dashboard)/farmer/orders/page.tsx`
- [Participant Messaging](https://github.com/xalhexi-sch/uma-market/blob/main/src/app/(dashboard)/messages/actions.ts): `src/app/(dashboard)/messages/actions.ts`

### Identity And Administration

- [Role Onboarding](https://github.com/xalhexi-sch/uma-market/blob/main/src/app/onboarding/actions.ts): `src/app/onboarding/actions.ts`
- **Clerk Identity**
- [Identity Sync Webhook](https://github.com/xalhexi-sch/uma-market/blob/main/src/app/api/webhooks/clerk/route.ts): `src/app/api/webhooks/clerk/route.ts`
- [Admin Workspaces](https://github.com/xalhexi-sch/uma-market/blob/main/src/app/(dashboard)/admin/actions.ts): `src/app/(dashboard)/admin/actions.ts`

### Data Services

- [Product Queries](https://github.com/xalhexi-sch/uma-market/blob/main/src/lib/supabase/queries/products.ts): `src/lib/supabase/queries/products.ts`
- [Order Queries](https://github.com/xalhexi-sch/uma-market/blob/main/src/lib/supabase/queries/orders.ts): `src/lib/supabase/queries/orders.ts`
- [Profile Queries](https://github.com/xalhexi-sch/uma-market/blob/main/src/lib/supabase/queries/profiles.ts): `src/lib/supabase/queries/profiles.ts`
- [RLS Server Client](https://github.com/xalhexi-sch/uma-market/blob/main/src/lib/supabase/server.ts): `src/lib/supabase/server.ts`
- **Supabase PostgreSQL**

### Other components

- **Business Buyer**
- **Farmer**
- **Administrator**
- **Clerk Service**

## Connections

- Business Buyer → Marketplace Home: visits
- Business Buyer → Public Catalog: browses
- Public Catalog → Live Search UI: hosts search
- Live Search UI → Search API: fetches results
- Search API → Product Queries: calls search
- Product Queries → Supabase PostgreSQL: queries listings
- Business Buyer → Product Details: inspects produce
- Business Buyer → Grouped Cart: shops
- Business Buyer → B2B Checkout: submits purchase
- Business Buyer → Order History And Tracking: tracks orders
- Farmer → Produce Inventory: manages listings
- Produce Inventory → Listing Form: uses form
- Listing Form → Produce Inventory: calls actions
- Farmer → Incoming Orders: manages fulfillment
- Farmer → Participant Messaging: communicates
- Business Buyer → Participant Messaging: communicates
- Business Buyer → Role Onboarding: completes onboarding
- Farmer → Role Onboarding: completes onboarding
- Administrator → Admin Workspaces: administers platform
- Role Onboarding → Clerk Identity: assigns role
- Clerk Identity → Clerk Service: authenticates
- Clerk Service → Identity Sync Webhook: sends events
- Identity Sync Webhook → Supabase PostgreSQL: syncs profiles
- RLS Server Client → Clerk Identity: gets session token
- RLS Server Client → Supabase PostgreSQL: connects with RLS
