# jbcbutad/olfumarketplace architecture

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

- Interactive diagram: https://gitdiagram.com/jbcbutad/olfumarketplace
- Repository: https://github.com/jbcbutad/olfumarketplace

## Overview

This tree is an OLFU Valenzuela student marketplace, despite the unrelated Supabase CLI README. The main user journey is sign-in, browsing or searching listings, then contacting sellers and managing transactions; supporting branches include AI assistance, campus merchandise, and staff administration. Shared Supabase clients provide the visible data-access layer. Several domain pages and API routes are named by the tree but were not sampled, so their connections are shown only as unverified dashed links where useful; the graph does not assume their internal call flow.

Main entry points: [`marketplace/src/app/(main)/marketplace/page.js`](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(main)/marketplace/page.js) (Browse and search), [`marketplace/src/app/(main)/products/[id]/page.js`](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(main)/products/%5Bid%5D/page.js) (Listing details), [`marketplace/src/app/api/moderate-listing/route.js`](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/api/moderate-listing/route.js) (Listing moderation), [`marketplace/src/app/(admin)/admin/categories/page.tsx`](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(admin)/admin/categories/page.tsx) (Category management)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_identity["Identity"]
  node_login["Sign-in<br/>[page.tsx]"]
  node_authcb["Auth callback<br/>[route.ts]"]
end

subgraph group_market["Marketplace"]
  node_landing["Marketplace landing<br/>[page.tsx]"]
  node_browse["Browse and search<br/>[page.js]"]
  node_categories["Categories<br/>[page.js]"]
  node_product["Listing details<br/>[page.js]"]
  node_create["Create listing<br/>[page.js]"]
  node_seller["Seller listings<br/>[page.js]"]
  node_history["Orders and history<br/>[page.js]"]
  node_reviews["Product reviews<br/>[ProductReviews.js]"]
end

subgraph group_engagement["Messaging and AI"]
  node_chat["Direct messaging<br/>[page.js]"]
  node_chatcreate["Create chat room<br/>[index.ts]"]
  node_aichat["AI chat<br/>[route.js]"]
  node_listingai["Listing assistance<br/>[route.ts]"]
  node_moderation["Listing moderation<br/>[route.js]"]
end

subgraph group_operations["Administration"]
  node_adminhome["Admin dashboard<br/>[page.tsx]"]
  node_adminusers["User administration<br/>[page.tsx]"]
  node_admincategories["Category management<br/>[page.tsx]"]
  node_categoryui["Category manager"]
  node_categoryactions["Category actions<br/>[actions.ts]"]
  node_reports["Report moderation<br/>[page.tsx]"]
  node_analytics["Analytics dashboard"]
end

subgraph group_platform["Shared platform"]
  node_supabaseclient["Supabase browser client<br/>[client.ts]"]
  node_supabaseserver["Supabase server client<br/>[server.ts]"]
  node_database[("Supabase data store")]
end

node_visitor(("Visitor or member"))
node_google["Google OAuth"]
node_gemini["Google Gemini"]

node_visitor -->|"signs in"| node_login
node_login -->|"starts OAuth"| node_google
node_visitor -.->|"browses"| node_landing
node_landing -->|"links to browse"| node_browse
node_browse -.->|"opens listing"| node_product
node_visitor -.->|"creates listing"| node_create
node_visitor -.->|"manages listings"| node_seller
node_product -.->|"contacts seller"| node_chat
node_chat -.->|"creates room"| node_chatcreate
node_visitor -.->|"requests AI chat"| node_aichat
node_visitor -.->|"requests listing help"| node_listingai
node_visitor -.->|"submits listing"| node_moderation
node_moderation -->|"authenticates with"| node_supabaseserver
node_moderation -->|"moderates content"| node_gemini
node_adminhome -->|"reads metrics"| node_database
node_adminusers -->|"queries profiles"| node_database
node_admincategories -->|"loads category data"| node_supabaseserver
node_admincategories -->|"renders manager"| node_categoryui
node_categoryui -->|"invokes actions"| node_categoryactions
node_categoryactions -->|"updates categories"| node_database
node_reports -->|"moderates reports"| node_database
node_analytics -.->|"reads analytics"| node_database
node_browse -.->|"uses data access"| node_supabaseclient
node_product -.->|"shows reviews"| node_reviews
node_history -.->|"reads transactions"| node_database

click node_login "https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(auth)/login/page.tsx"
click node_authcb "https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(auth)/callback/route.ts"
click node_landing "https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/page.tsx"
click node_browse "https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(main)/marketplace/page.js"
click node_categories "https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(main)/categories/page.js"
click node_product "https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(main)/products/%5Bid%5D/page.js"
click node_create "https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(main)/create-listing/page.js"
click node_seller "https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(main)/mylistings/page.js"
click node_history "https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(main)/purchase-history/page.js"
click node_reviews "https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/components/ProductReviews.js"
click node_chat "https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(main)/chat/%5BroomId%5D/page.js"
click node_chatcreate "https://github.com/jbcbutad/olfumarketplace/blob/main/supabase/functions/create-1-1-chat/index.ts"
click node_aichat "https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/api/ai-chat/route.js"
click node_listingai "https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/api/generate-listing/route.ts"
click node_moderation "https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/api/moderate-listing/route.js"
click node_adminhome "https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(admin)/admin/page.tsx"
click node_adminusers "https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(admin)/admin/users/page.tsx"
click node_admincategories "https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(admin)/admin/categories/page.tsx"
click node_categoryui "https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(admin)/admin/categories/CategoriesManager.tsx"
click node_categoryactions "https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(admin)/admin/categories/actions.ts"
click node_reports "https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(admin)/admin/reports/page.tsx"
click node_analytics "https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(admin)/admin/analytics/AnalyticsContent.tsx"
click node_supabaseclient "https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/lib/supabase/client.ts"
click node_supabaseserver "https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/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_login,node_authcb toneBlue
class node_landing,node_browse,node_categories,node_product,node_create,node_seller,node_history,node_reviews toneAmber
class node_chat,node_chatcreate,node_aichat,node_listingai,node_moderation toneMint
class node_adminhome,node_adminusers,node_admincategories,node_categoryui,node_categoryactions,node_reports,node_analytics toneRose
class node_supabaseclient,node_supabaseserver,node_database,node_visitor,node_google,node_gemini toneIndigo
```

## Components

### Identity

- [Sign-in](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(auth)/login/page.tsx): `marketplace/src/app/(auth)/login/page.tsx`
- [Auth callback](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(auth)/callback/route.ts): `marketplace/src/app/(auth)/callback/route.ts`

### Marketplace

- [Marketplace landing](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/page.tsx): `marketplace/src/app/page.tsx`
- [Browse and search](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(main)/marketplace/page.js): `marketplace/src/app/(main)/marketplace/page.js`
- [Categories](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(main)/categories/page.js): `marketplace/src/app/(main)/categories/page.js`
- [Listing details](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(main)/products/%5Bid%5D/page.js): `marketplace/src/app/(main)/products/[id]/page.js`
- [Create listing](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(main)/create-listing/page.js): `marketplace/src/app/(main)/create-listing/page.js`
- [Seller listings](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(main)/mylistings/page.js): `marketplace/src/app/(main)/mylistings/page.js`
- [Orders and history](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(main)/purchase-history/page.js): `marketplace/src/app/(main)/purchase-history/page.js`
- [Product reviews](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/components/ProductReviews.js): `marketplace/src/components/ProductReviews.js`

### Messaging and AI

- [Direct messaging](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(main)/chat/%5BroomId%5D/page.js): `marketplace/src/app/(main)/chat/[roomId]/page.js`
- [Create chat room](https://github.com/jbcbutad/olfumarketplace/blob/main/supabase/functions/create-1-1-chat/index.ts): `supabase/functions/create-1-1-chat/index.ts`
- [AI chat](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/api/ai-chat/route.js): `marketplace/src/app/api/ai-chat/route.js`
- [Listing assistance](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/api/generate-listing/route.ts): `marketplace/src/app/api/generate-listing/route.ts`
- [Listing moderation](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/api/moderate-listing/route.js): `marketplace/src/app/api/moderate-listing/route.js`

### Administration

- [Admin dashboard](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(admin)/admin/page.tsx): `marketplace/src/app/(admin)/admin/page.tsx`
- [User administration](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(admin)/admin/users/page.tsx): `marketplace/src/app/(admin)/admin/users/page.tsx`
- [Category management](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(admin)/admin/categories/page.tsx): `marketplace/src/app/(admin)/admin/categories/page.tsx`
- [Category manager](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(admin)/admin/categories/CategoriesManager.tsx): `marketplace/src/app/(admin)/admin/categories/CategoriesManager.tsx`
- [Category actions](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(admin)/admin/categories/actions.ts): `marketplace/src/app/(admin)/admin/categories/actions.ts`
- [Report moderation](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(admin)/admin/reports/page.tsx): `marketplace/src/app/(admin)/admin/reports/page.tsx`
- [Analytics dashboard](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/app/(admin)/admin/analytics/AnalyticsContent.tsx): `marketplace/src/app/(admin)/admin/analytics/AnalyticsContent.tsx`

### Shared platform

- [Supabase browser client](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/lib/supabase/client.ts): `marketplace/src/lib/supabase/client.ts`
- [Supabase server client](https://github.com/jbcbutad/olfumarketplace/blob/main/marketplace/src/lib/supabase/server.ts): `marketplace/src/lib/supabase/server.ts`
- **Supabase data store**

### Other components

- **Visitor or member**
- **Google OAuth**
- **Google Gemini**

## Connections

- Visitor or member → Sign-in: signs in
- Sign-in → Google OAuth: starts OAuth (evidence: `marketplace/src/app/(auth)/login/page.tsx`)
- Visitor or member → Marketplace landing: browses
- Marketplace landing → Browse and search: links to browse (evidence: `marketplace/src/app/page.tsx`)
- Browse and search → Listing details: opens listing
- Visitor or member → Create listing: creates listing
- Visitor or member → Seller listings: manages listings
- Listing details → Direct messaging: contacts seller
- Direct messaging → Create chat room: creates room
- Visitor or member → AI chat: requests AI chat
- Visitor or member → Listing assistance: requests listing help
- Visitor or member → Listing moderation: submits listing
- Listing moderation → Supabase server client: authenticates with (evidence: `marketplace/src/app/api/moderate-listing/route.js`)
- Listing moderation → Google Gemini: moderates content (evidence: `marketplace/src/app/api/moderate-listing/route.js`)
- Admin dashboard → Supabase data store: reads metrics (evidence: `marketplace/src/app/(admin)/admin/page.tsx`)
- User administration → Supabase data store: queries profiles (evidence: `marketplace/src/app/(admin)/admin/users/page.tsx`)
- Category management → Supabase server client: loads category data (evidence: `marketplace/src/app/(admin)/admin/categories/page.tsx`)
- Category management → Category manager: renders manager (evidence: `marketplace/src/app/(admin)/admin/categories/page.tsx`)
- Category manager → Category actions: invokes actions (evidence: `marketplace/src/app/(admin)/admin/categories/CategoriesManager.tsx`)
- Category actions → Supabase data store: updates categories (evidence: `marketplace/src/app/(admin)/admin/categories/actions.ts`)
- Report moderation → Supabase data store: moderates reports (evidence: `marketplace/src/app/(admin)/admin/reports/page.tsx`)
- Analytics dashboard → Supabase data store: reads analytics
- Browse and search → Supabase browser client: uses data access
- Listing details → Product reviews: shows reviews
- Orders and history → Supabase data store: reads transactions
