# mfinayat/auctionhouse architecture

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

- Interactive diagram: https://gitdiagram.com/mfinayat/auctionhouse
- Repository: https://github.com/mfinayat/auctionhouse

## Overview

AuctionHouse.pk is a property marketplace and auction service. Requests enter through the Cloudflare Worker: public page requests are rendered as HTML, while API requests are delegated to the application handler and routed to domain services. Those services support accounts, listings and auctions, deals, staff operations, notifications, and live updates, with account and marketplace state stored in D1. The source index and excerpts establish several dispatches and worker actions; many domain modules are unsampled, so their internal call relationships are not inferred.

Main entry points: [`source/app/api/[...path]/route.ts`](https://github.com/mfinayat/auctionhouse/blob/main/source/app/api/%5B...path%5D/route.ts) (API router), [`source/worker/index.ts`](https://github.com/mfinayat/auctionhouse/blob/main/source/worker/index.ts) (Cloudflare Worker), [`source/app/lib/notifications.ts`](https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/notifications.ts) (Notifications), [`source/app/lib/auctions.ts`](https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/auctions.ts) (Listings and auctions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Request entry"]
  node_worker["Cloudflare Worker<br/>[index.ts]"]
  node_api["API router<br/>[route.ts]"]
  node_pages["Public pages<br/>[public-pages.ts]"]
  node_shell["HTML shell<br/>[site-shell.ts]"]
end

subgraph group_market["Marketplace domains"]
  node_auctions["Listings and auctions<br/>[auctions.ts]"]
  node_deals["Deals<br/>[deals.ts]"]
  node_review["Listing review<br/>[review-v2.ts]"]
  node_wallet["Wallet and holds<br/>[wallet.ts]"]
end

subgraph group_support["Accounts and support"]
  node_accounts["Accounts<br/>[accounts.ts]"]
  node_operations["Operations<br/>[operations.ts]"]
  node_staff["Staff access<br/>[staff.ts]"]
  node_media["Media<br/>[media.ts]"]
  node_notifications["Notifications<br/>[notifications.ts]"]
  node_live["Live updates<br/>[live.ts]"]
  node_livepush["Live publishing<br/>[live-push.ts]"]
  node_hub["Live Hub<br/>[live-hub.ts]"]
end

subgraph group_state["Runtime and state"]
  node_database[("D1 database<br/>[schema.ts]")]
  node_platform["Platform utilities<br/>[platform.ts]"]
end

node_visitor(("Visitor"))

node_visitor -->|"sends requests"| node_worker
node_worker -->|"renders page data"| node_pages
node_worker -->|"renders HTML"| node_shell
node_worker -->|"delegates requests"| node_api
node_api -->|"checks accounts"| node_accounts
node_api -->|"routes auction APIs"| node_auctions
node_api -->|"routes deal APIs"| node_deals
node_api -->|"routes operations"| node_operations
node_api -->|"routes staff APIs"| node_staff
node_api -->|"routes media APIs"| node_media
node_api -->|"routes notifications"| node_notifications
node_api -->|"routes live API"| node_live
node_worker -->|"publishes changes"| node_livepush
node_worker -->|"delivers notifications"| node_notifications
node_worker -->|"expires listings"| node_auctions
node_worker -->|"releases holds"| node_wallet
node_livepush -->|"publishes events"| node_hub
node_accounts -->|"accesses D1"| node_database
node_auctions -->|"reads and writes"| node_database
node_review -->|"reserves deposits"| node_wallet
node_review -->|"records responses"| node_notifications
node_notifications -->|"stores notices"| node_database

click node_worker "https://github.com/mfinayat/auctionhouse/blob/main/source/worker/index.ts"
click node_api "https://github.com/mfinayat/auctionhouse/blob/main/source/app/api/%5B...path%5D/route.ts"
click node_pages "https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/public-pages.ts"
click node_shell "https://github.com/mfinayat/auctionhouse/blob/main/source/app/site-shell.ts"
click node_accounts "https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/accounts.ts"
click node_auctions "https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/auctions.ts"
click node_deals "https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/deals.ts"
click node_review "https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/review-v2.ts"
click node_wallet "https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/wallet.ts"
click node_operations "https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/operations.ts"
click node_staff "https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/staff.ts"
click node_media "https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/media.ts"
click node_notifications "https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/notifications.ts"
click node_live "https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/live.ts"
click node_livepush "https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/live-push.ts"
click node_hub "https://github.com/mfinayat/auctionhouse/blob/main/source/worker/live-hub.ts"
click node_database "https://github.com/mfinayat/auctionhouse/blob/main/source/db/schema.ts"
click node_platform "https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/platform.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_worker,node_api,node_pages,node_shell toneBlue
class node_auctions,node_deals,node_review,node_wallet toneAmber
class node_accounts,node_operations,node_staff,node_media,node_notifications,node_live,node_livepush,node_hub toneMint
class node_database,node_platform toneRose
class node_visitor toneIndigo
```

## Components

### Request entry

- [Cloudflare Worker](https://github.com/mfinayat/auctionhouse/blob/main/source/worker/index.ts): `source/worker/index.ts`
- [API router](https://github.com/mfinayat/auctionhouse/blob/main/source/app/api/%5B...path%5D/route.ts): `source/app/api/[...path]/route.ts`
- [Public pages](https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/public-pages.ts): `source/app/lib/public-pages.ts`
- [HTML shell](https://github.com/mfinayat/auctionhouse/blob/main/source/app/site-shell.ts): `source/app/site-shell.ts`

### Marketplace domains

- [Listings and auctions](https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/auctions.ts): `source/app/lib/auctions.ts`
- [Deals](https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/deals.ts): `source/app/lib/deals.ts`
- [Listing review](https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/review-v2.ts): `source/app/lib/review-v2.ts`
- [Wallet and holds](https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/wallet.ts): `source/app/lib/wallet.ts`

### Accounts and support

- [Accounts](https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/accounts.ts): `source/app/lib/accounts.ts`
- [Operations](https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/operations.ts): `source/app/lib/operations.ts`
- [Staff access](https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/staff.ts): `source/app/lib/staff.ts`
- [Media](https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/media.ts): `source/app/lib/media.ts`
- [Notifications](https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/notifications.ts): `source/app/lib/notifications.ts`
- [Live updates](https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/live.ts): `source/app/lib/live.ts`
- [Live publishing](https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/live-push.ts): `source/app/lib/live-push.ts`
- [Live Hub](https://github.com/mfinayat/auctionhouse/blob/main/source/worker/live-hub.ts): `source/worker/live-hub.ts`

### Runtime and state

- [D1 database](https://github.com/mfinayat/auctionhouse/blob/main/source/db/schema.ts): `source/db/schema.ts`
- [Platform utilities](https://github.com/mfinayat/auctionhouse/blob/main/source/app/lib/platform.ts): `source/app/lib/platform.ts`

### Other components

- **Visitor**

## Connections

- Visitor → Cloudflare Worker: sends requests (evidence: `source/worker/index.ts`)
- Cloudflare Worker → Public pages: renders page data (evidence: `source/worker/index.ts`)
- Cloudflare Worker → HTML shell: renders HTML (evidence: `source/worker/index.ts`)
- Cloudflare Worker → API router: delegates requests (evidence: `source/worker/index.ts`)
- API router → Accounts: checks accounts (evidence: `source/app/api/[...path]/route.ts`)
- API router → Listings and auctions: routes auction APIs (evidence: `source/app/api/[...path]/route.ts`)
- API router → Deals: routes deal APIs (evidence: `source/app/api/[...path]/route.ts`)
- API router → Operations: routes operations (evidence: `source/app/api/[...path]/route.ts`)
- API router → Staff access: routes staff APIs (evidence: `source/app/api/[...path]/route.ts`)
- API router → Media: routes media APIs (evidence: `source/app/api/[...path]/route.ts`)
- API router → Notifications: routes notifications (evidence: `source/app/api/[...path]/route.ts`)
- API router → Live updates: routes live API (evidence: `source/app/api/[...path]/route.ts`)
- Cloudflare Worker → Live publishing: publishes changes (evidence: `source/worker/index.ts`)
- Cloudflare Worker → Notifications: delivers notifications (evidence: `source/worker/index.ts`)
- Cloudflare Worker → Listings and auctions: expires listings (evidence: `source/worker/index.ts`)
- Cloudflare Worker → Wallet and holds: releases holds (evidence: `source/worker/index.ts`)
- Live publishing → Live Hub: publishes events (evidence: `source/worker/index.ts`)
- Accounts → D1 database: accesses D1 (evidence: `source/app/lib/accounts.ts`)
- Listings and auctions → D1 database: reads and writes (evidence: `source/app/lib/auctions.ts`)
- Listing review → Wallet and holds: reserves deposits (evidence: `source/app/lib/review-v2.ts`)
- Listing review → Notifications: records responses (evidence: `source/app/lib/review-v2.ts`)
- Notifications → D1 database: stores notices (evidence: `source/app/lib/notifications.ts`)
