# kusarithegorgon-eng/thriftsync architecture

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

- Interactive diagram: https://gitdiagram.com/kusarithegorgon-eng/thriftsync
- Repository: https://github.com/kusarithegorgon-eng/thriftsync

## Overview

ThriftSync is a Cebu-focused secondhand marketplace for buyers and boutique sellers. Buyers discover listings, add items to a cart, choose delivery or locker handoff, and complete checkout; sellers publish listings and manage orders, while admins moderate the marketplace. Separate capabilities include auctions, messaging and trust tools, vouchers, and an optional boutique-trip planner. The frontend uses Supabase for auth, data, storage, and Edge Functions. Some page-to-service links are supported only by the source index or README; unsampled internals are not inferred.

Main entry points: [`src/lib/supabase.ts`](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/lib/supabase.ts) (Supabase client), [`src/App.tsx`](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/App.tsx) (App and routes), [`src/pages/CheckoutPage.tsx`](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/CheckoutPage.tsx) (Checkout), [`src/pages/BrowsePage.tsx`](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/BrowsePage.tsx) (Browse listings)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Marketplace experience"]
  node_web_app["App and routes<br/>[App.tsx]"]
  node_auth_ui["Sign in and signup<br/>[AuthPage.tsx]"]
  node_browse["Browse listings<br/>[BrowsePage.tsx]"]
  node_listing_detail["Listing details"]
  node_listing_card["Listing card<br/>[ListingCard.tsx]"]
  node_messages["Buyer-seller messages<br/>[MessagesPage.tsx]"]
end

subgraph group_commerce["Checkout and fulfillment"]
  node_cart["Cart state<br/>[cart.tsx]"]
  node_checkout["Checkout<br/>[CheckoutPage.tsx]"]
  node_paymongo_client["PayMongo client<br/>[paymongo.ts]"]
  node_paymongo_fn["PayMongo checkout<br/>[index.ts]"]
  node_orders["Orders and fulfillment<br/>[OrdersPage.tsx]"]
  node_lockers["Locker network"]
  node_vouchers["Vouchers<br/>[VouchersPage.tsx]"]
end

subgraph group_seller["Seller and trust operations"]
  node_sell["Listing creation<br/>[SellPage.tsx]"]
  node_dashboard["Seller dashboard<br/>[DashboardPage.tsx]"]
  node_admin["Marketplace moderation<br/>[AdminPage.tsx]"]
  node_reports["Listing reports"]
  node_auction_ops["Auction operations<br/>[index.ts]"]
end

subgraph group_planning["Crawl planning"]
  node_crawl["Thrift Crawl planner"]
  node_crawl_fn["Route estimates<br/>[index.ts]"]
end

subgraph group_platform["Platform services"]
  node_auth["Authentication state<br/>[auth.tsx]"]
  node_supabase_client["Supabase client<br/>[supabase.ts]"]
  node_supabase[("Supabase services")]
  node_upload_fn["Signed upload URLs<br/>[index.ts]"]
end

node_buyer(("Buyer"))
node_seller_actor(("Seller"))
node_paymongo["PayMongo"]
node_maps["Google Maps Routes"]

node_buyer -->|"uses"| node_web_app
node_seller_actor -->|"uses"| node_web_app
node_web_app -->|"routes to"| node_browse
node_web_app -->|"routes to"| node_listing_detail
node_web_app -->|"routes to"| node_checkout
node_web_app -->|"routes to"| node_orders
node_web_app -->|"routes to"| node_sell
node_web_app -->|"routes to"| node_dashboard
node_web_app -->|"routes to"| node_crawl
node_auth_ui -->|"uses"| node_auth
node_auth -->|"queries"| node_supabase_client
node_browse -->|"renders"| node_listing_card
node_browse -->|"queries"| node_supabase_client
node_listing_detail -->|"queries"| node_supabase_client
node_listing_detail -->|"renders"| node_listing_card
node_messages -->|"uses"| node_supabase_client
node_checkout -->|"reads"| node_cart
node_checkout -->|"calls"| node_paymongo_client
node_paymongo_client -->|"uses"| node_supabase_client
node_checkout -->|"queries"| node_supabase_client
node_orders -->|"queries"| node_supabase_client
node_lockers -->|"queries"| node_supabase_client
node_vouchers -->|"queries"| node_supabase_client
node_sell -->|"uploads and writes"| node_supabase_client
node_dashboard -->|"queries"| node_supabase_client
node_admin -->|"queries"| node_supabase_client
node_reports -->|"submits reports"| node_supabase_client
node_dashboard -.->|"manages auctions"| node_auction_ops
node_crawl -->|"queries and saves"| node_supabase_client
node_crawl -.->|"requests estimates"| node_crawl_fn
node_supabase_client -->|"connects"| node_supabase
node_paymongo_fn -->|"creates hosted checkout"| node_paymongo
node_paymongo_fn -->|"creates paid orders"| node_supabase
node_crawl_fn -.->|"routes optionally"| node_maps
node_upload_fn -.->|"provides upload URLs"| node_supabase

click node_web_app "https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/App.tsx"
click node_auth_ui "https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/AuthPage.tsx"
click node_auth "https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/lib/auth.tsx"
click node_browse "https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/BrowsePage.tsx"
click node_listing_detail "https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/ListingDetailPage.tsx"
click node_listing_card "https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/components/ListingCard.tsx"
click node_messages "https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/MessagesPage.tsx"
click node_cart "https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/lib/cart.tsx"
click node_checkout "https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/CheckoutPage.tsx"
click node_paymongo_client "https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/lib/paymongo.ts"
click node_paymongo_fn "https://github.com/kusarithegorgon-eng/thriftsync/blob/main/supabase/functions/paymongo-checkout/index.ts"
click node_orders "https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/OrdersPage.tsx"
click node_lockers "https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/LockerNetworkPage.tsx"
click node_vouchers "https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/VouchersPage.tsx"
click node_sell "https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/SellPage.tsx"
click node_dashboard "https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/DashboardPage.tsx"
click node_admin "https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/AdminPage.tsx"
click node_reports "https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/components/ReportSubmissionModal.tsx"
click node_auction_ops "https://github.com/kusarithegorgon-eng/thriftsync/blob/main/supabase/functions/auction-ops/index.ts"
click node_crawl "https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/ThriftCrawlPage.tsx"
click node_crawl_fn "https://github.com/kusarithegorgon-eng/thriftsync/blob/main/supabase/functions/thrift-crawl/index.ts"
click node_supabase_client "https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/lib/supabase.ts"
click node_upload_fn "https://github.com/kusarithegorgon-eng/thriftsync/blob/main/supabase/functions/generate-upload-url/index.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_web_app,node_auth_ui,node_browse,node_listing_detail,node_listing_card,node_messages toneBlue
class node_cart,node_checkout,node_paymongo_client,node_paymongo_fn,node_orders,node_lockers,node_vouchers toneAmber
class node_sell,node_dashboard,node_admin,node_reports,node_auction_ops,node_maps toneMint
class node_crawl,node_crawl_fn toneRose
class node_auth,node_supabase_client,node_supabase,node_upload_fn,node_buyer,node_seller_actor,node_paymongo toneIndigo
```

## Components

### Marketplace experience

- [App and routes](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/App.tsx): `src/App.tsx`
- [Sign in and signup](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/AuthPage.tsx): `src/pages/AuthPage.tsx`
- [Browse listings](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/BrowsePage.tsx): `src/pages/BrowsePage.tsx`
- [Listing details](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/ListingDetailPage.tsx): `src/pages/ListingDetailPage.tsx`
- [Listing card](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/components/ListingCard.tsx): `src/components/ListingCard.tsx`
- [Buyer-seller messages](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/MessagesPage.tsx): `src/pages/MessagesPage.tsx`

### Checkout and fulfillment

- [Cart state](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/lib/cart.tsx): `src/lib/cart.tsx`
- [Checkout](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/CheckoutPage.tsx): `src/pages/CheckoutPage.tsx`
- [PayMongo client](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/lib/paymongo.ts): `src/lib/paymongo.ts`
- [PayMongo checkout](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/supabase/functions/paymongo-checkout/index.ts): `supabase/functions/paymongo-checkout/index.ts`
- [Orders and fulfillment](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/OrdersPage.tsx): `src/pages/OrdersPage.tsx`
- [Locker network](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/LockerNetworkPage.tsx): `src/pages/LockerNetworkPage.tsx`
- [Vouchers](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/VouchersPage.tsx): `src/pages/VouchersPage.tsx`

### Seller and trust operations

- [Listing creation](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/SellPage.tsx): `src/pages/SellPage.tsx`
- [Seller dashboard](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/DashboardPage.tsx): `src/pages/DashboardPage.tsx`
- [Marketplace moderation](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/AdminPage.tsx): `src/pages/AdminPage.tsx`
- [Listing reports](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/components/ReportSubmissionModal.tsx): `src/components/ReportSubmissionModal.tsx`
- [Auction operations](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/supabase/functions/auction-ops/index.ts): `supabase/functions/auction-ops/index.ts`

### Crawl planning

- [Thrift Crawl planner](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/pages/ThriftCrawlPage.tsx): `src/pages/ThriftCrawlPage.tsx`
- [Route estimates](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/supabase/functions/thrift-crawl/index.ts): `supabase/functions/thrift-crawl/index.ts`

### Platform services

- [Authentication state](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/lib/auth.tsx): `src/lib/auth.tsx`
- [Supabase client](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/src/lib/supabase.ts): `src/lib/supabase.ts`
- **Supabase services**
- [Signed upload URLs](https://github.com/kusarithegorgon-eng/thriftsync/blob/main/supabase/functions/generate-upload-url/index.ts): `supabase/functions/generate-upload-url/index.ts`

### Other components

- **Buyer**
- **Seller**
- **PayMongo**
- **Google Maps Routes**

## Connections

- Buyer → App and routes: uses (evidence: `README.md`)
- Seller → App and routes: uses (evidence: `README.md`)
- App and routes → Browse listings: routes to (evidence: `src/App.tsx`)
- App and routes → Listing details: routes to (evidence: `src/App.tsx`)
- App and routes → Checkout: routes to (evidence: `src/App.tsx`)
- App and routes → Orders and fulfillment: routes to (evidence: `src/App.tsx`)
- App and routes → Listing creation: routes to (evidence: `src/App.tsx`)
- App and routes → Seller dashboard: routes to (evidence: `src/App.tsx`)
- App and routes → Thrift Crawl planner: routes to (evidence: `src/App.tsx`)
- Sign in and signup → Authentication state: uses (evidence: `src/pages/AuthPage.tsx`)
- Authentication state → Supabase client: queries (evidence: `src/lib/auth.tsx`)
- Browse listings → Listing card: renders (evidence: `src/pages/BrowsePage.tsx`)
- Browse listings → Supabase client: queries (evidence: `src/pages/BrowsePage.tsx`)
- Listing details → Supabase client: queries (evidence: `src/pages/ListingDetailPage.tsx`)
- Listing details → Listing card: renders (evidence: `src/pages/ListingDetailPage.tsx`)
- Buyer-seller messages → Supabase client: uses
- Checkout → Cart state: reads (evidence: `src/pages/CheckoutPage.tsx`)
- Checkout → PayMongo client: calls (evidence: `src/pages/CheckoutPage.tsx`)
- PayMongo client → Supabase client: uses (evidence: `src/lib/paymongo.ts`)
- Checkout → Supabase client: queries (evidence: `src/pages/CheckoutPage.tsx`)
- Orders and fulfillment → Supabase client: queries (evidence: `src/pages/OrdersPage.tsx`)
- Locker network → Supabase client: queries (evidence: `src/pages/LockerNetworkPage.tsx`)
- Vouchers → Supabase client: queries (evidence: `src/pages/VouchersPage.tsx`)
- Listing creation → Supabase client: uploads and writes (evidence: `src/pages/SellPage.tsx`)
- Seller dashboard → Supabase client: queries (evidence: `src/pages/DashboardPage.tsx`)
- Marketplace moderation → Supabase client: queries (evidence: `src/pages/AdminPage.tsx`)
- Listing reports → Supabase client: submits reports (evidence: `src/components/ReportSubmissionModal.tsx`)
- Seller dashboard → Auction operations: manages auctions (evidence: `README.md`)
- Thrift Crawl planner → Supabase client: queries and saves (evidence: `src/pages/ThriftCrawlPage.tsx`)
- Thrift Crawl planner → Route estimates: requests estimates (evidence: `README.md`)
- Supabase client → Supabase services: connects (evidence: `README.md`)
- PayMongo checkout → PayMongo: creates hosted checkout (evidence: `README.md`)
- PayMongo checkout → Supabase services: creates paid orders (evidence: `README.md`)
- Route estimates → Google Maps Routes: routes optionally (evidence: `README.md`)
- Signed upload URLs → Supabase services: provides upload URLs (evidence: `README.md`)
