# 3mmaryasser/uk-property-scraper architecture

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

- Interactive diagram: https://gitdiagram.com/3mmaryasser/uk-property-scraper
- Repository: https://github.com/3mmaryasser/uk-property-scraper

## Overview

This repository is a UK property-listing scraper, monitoring API, and dashboard. Users browse and filter listings, inspect images and price history, and view market-pulse and pipeline-health data; operators trigger scheduled or manual scrape runs. Scraping separates search-page discovery from per-listing extraction, then validates and stores listing, image, price-history, run, and quality data. The graph preserves documented stages and dashboard capabilities; unsampled worker and health internals are represented at their existing source paths, with those links grounded in the README rather than inspected implementation.

Main entry points: [`apps/api/src/queue/scrape-listing.processor.ts`](https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/queue/scrape-listing.processor.ts) (Listing worker), [`apps/api/src/runs/runs.service.ts`](https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/runs/runs.service.ts) (Run and health data), [`apps/web/lib/api.ts`](https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/web/lib/api.ts) (Dashboard API client), [`apps/api/src/queue/crawl-search.processor.ts`](https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/queue/crawl-search.processor.ts) (Search crawler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_scrape["Scrape pipeline"]
  node_schedule["Scrape scheduler"]
  node_manual["Manual trigger"]
  node_producer["Scrape producer<br/>[scrape.producer.ts]"]
  node_crawlq["Search queue<br/>[queue.constants.ts]"]
  node_crawler["Search crawler"]
  node_listingq["Listing queue<br/>[queue.constants.ts]"]
  node_scraper["Listing worker"]
  node_browser["Browser rendering<br/>[browser.service.ts]"]
  node_adapter["Portal extraction"]
  node_validation["Listing validation<br/>[listing.schema.ts]"]
end

subgraph group_api["API and monitoring"]
  node_tracker["Run and quality tracker"]
  node_listingapi["Listing endpoints"]
  node_runapi["Run endpoints<br/>[runs.controller.ts]"]
  node_runservice["Run and health data<br/>[runs.service.ts]"]
  node_health["Pipeline health"]
  node_metrics["Metrics endpoint"]
end

subgraph group_storage["Listing data"]
  node_listingservice["Listing queries and upsert"]
  node_dbservice["Prisma client<br/>[prisma.service.ts]"]
  node_database[("PostgreSQL<br/>[index.ts]")]
end

subgraph group_dashboard["Keystone dashboard"]
  node_home["Listings dashboard<br/>[page.tsx]"]
  node_detail["Property detail<br/>[page.tsx]"]
  node_healthpage["Health console<br/>[page.tsx]"]
  node_webapi["Dashboard API client<br/>[api.ts]"]
end

node_operator(("Scrape operator"))
node_portal{{"OnTheMarket"}}
node_apiuser(("Dashboard visitor"))
node_rest{{"REST API"}}

node_operator -->|"triggers"| node_manual
node_schedule -.->|"starts runs"| node_producer
node_manual -->|"starts run"| node_producer
node_producer -->|"enqueues search"| node_crawlq
node_crawlq -->|"dispatches"| node_crawler
node_crawler -->|"enqueues listings"| node_listingq
node_crawler -->|"enqueues next page"| node_crawlq
node_listingq -->|"dispatches"| node_scraper
node_scraper -.->|"renders pages"| node_browser
node_browser -.->|"fetches pages"| node_portal
node_scraper -.->|"extracts listing"| node_adapter
node_scraper -.->|"validates listing"| node_validation
node_scraper -.->|"upserts listing"| node_listingservice
node_scraper -.->|"tracks run quality"| node_tracker
node_tracker -->|"finalizes run"| node_runservice
node_listingapi -->|"queries listings"| node_listingservice
node_runapi -->|"queries runs"| node_runservice
node_health -->|"reads pipeline state"| node_runservice
node_listingservice -->|"queries and writes"| node_dbservice
node_runservice -->|"queries and writes"| node_dbservice
node_dbservice -->|"persists records"| node_database
node_apiuser -->|"browses"| node_home
node_home -->|"requests listings and pulse"| node_webapi
node_detail -->|"requests property"| node_webapi
node_healthpage -.->|"requests health and runs"| node_webapi
node_webapi -->|"calls"| node_rest
node_rest -.->|"routes listing requests"| node_listingapi
node_rest -.->|"routes run requests"| node_runapi
node_rest -.->|"routes health requests"| node_health
node_rest -.->|"serves metrics"| node_metrics

click node_schedule "https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/scheduler/scrape.scheduler.ts"
click node_manual "https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/queue/scrape.controller.ts"
click node_producer "https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/queue/scrape.producer.ts"
click node_crawlq "https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/queue/queue.constants.ts"
click node_crawler "https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/queue/crawl-search.processor.ts"
click node_listingq "https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/queue/queue.constants.ts"
click node_scraper "https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/queue/scrape-listing.processor.ts"
click node_browser "https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/scraper/browser.service.ts"
click node_adapter "https://github.com/3mmaryasser/uk-property-scraper/blob/main/packages/core/src/adapters/onthemarket.adapter.ts"
click node_validation "https://github.com/3mmaryasser/uk-property-scraper/blob/main/packages/core/src/listing.schema.ts"
click node_tracker "https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/queue/run-tracker.service.ts"
click node_listingapi "https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/listings/listings.controller.ts"
click node_listingservice "https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/listings/listings.service.ts"
click node_runapi "https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/runs/runs.controller.ts"
click node_runservice "https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/runs/runs.service.ts"
click node_health "https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/health/health.controller.ts"
click node_metrics "https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/health/metrics.controller.ts"
click node_dbservice "https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/prisma/prisma.service.ts"
click node_database "https://github.com/3mmaryasser/uk-property-scraper/blob/main/packages/database/src/index.ts"
click node_home "https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/web/app/page.tsx"
click node_detail "https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/web/app/listings/%5Bid%5D/page.tsx"
click node_healthpage "https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/web/app/health/page.tsx"
click node_webapi "https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/web/lib/api.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_schedule,node_manual,node_producer,node_crawlq,node_crawler,node_listingq,node_scraper,node_browser,node_adapter,node_validation toneBlue
class node_tracker,node_listingapi,node_runapi,node_runservice,node_health,node_metrics toneAmber
class node_listingservice,node_dbservice,node_database,node_rest toneMint
class node_home,node_detail,node_healthpage,node_webapi toneRose
class node_operator,node_portal,node_apiuser toneIndigo
```

## Components

### Scrape pipeline

- [Scrape scheduler](https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/scheduler/scrape.scheduler.ts): `apps/api/src/scheduler/scrape.scheduler.ts`
- [Manual trigger](https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/queue/scrape.controller.ts): `apps/api/src/queue/scrape.controller.ts`
- [Scrape producer](https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/queue/scrape.producer.ts): `apps/api/src/queue/scrape.producer.ts`
- [Search queue](https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/queue/queue.constants.ts): `apps/api/src/queue/queue.constants.ts`
- [Search crawler](https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/queue/crawl-search.processor.ts): `apps/api/src/queue/crawl-search.processor.ts`
- [Listing queue](https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/queue/queue.constants.ts): `apps/api/src/queue/queue.constants.ts`
- [Listing worker](https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/queue/scrape-listing.processor.ts): `apps/api/src/queue/scrape-listing.processor.ts`
- [Browser rendering](https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/scraper/browser.service.ts): `apps/api/src/scraper/browser.service.ts`
- [Portal extraction](https://github.com/3mmaryasser/uk-property-scraper/blob/main/packages/core/src/adapters/onthemarket.adapter.ts): `packages/core/src/adapters/onthemarket.adapter.ts`
- [Listing validation](https://github.com/3mmaryasser/uk-property-scraper/blob/main/packages/core/src/listing.schema.ts): `packages/core/src/listing.schema.ts`

### API and monitoring

- [Run and quality tracker](https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/queue/run-tracker.service.ts): `apps/api/src/queue/run-tracker.service.ts`
- [Listing endpoints](https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/listings/listings.controller.ts): `apps/api/src/listings/listings.controller.ts`
- [Run endpoints](https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/runs/runs.controller.ts): `apps/api/src/runs/runs.controller.ts`
- [Run and health data](https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/runs/runs.service.ts): `apps/api/src/runs/runs.service.ts`
- [Pipeline health](https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/health/health.controller.ts): `apps/api/src/health/health.controller.ts`
- [Metrics endpoint](https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/health/metrics.controller.ts): `apps/api/src/health/metrics.controller.ts`

### Listing data

- [Listing queries and upsert](https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/listings/listings.service.ts): `apps/api/src/listings/listings.service.ts`
- [Prisma client](https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/api/src/prisma/prisma.service.ts): `apps/api/src/prisma/prisma.service.ts`
- [PostgreSQL](https://github.com/3mmaryasser/uk-property-scraper/blob/main/packages/database/src/index.ts): `packages/database/src/index.ts`

### Keystone dashboard

- [Listings dashboard](https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/web/app/page.tsx): `apps/web/app/page.tsx`
- [Property detail](https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/web/app/listings/%5Bid%5D/page.tsx): `apps/web/app/listings/[id]/page.tsx`
- [Health console](https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/web/app/health/page.tsx): `apps/web/app/health/page.tsx`
- [Dashboard API client](https://github.com/3mmaryasser/uk-property-scraper/blob/main/apps/web/lib/api.ts): `apps/web/lib/api.ts`

### Other components

- **Scrape operator**
- **OnTheMarket**
- **Dashboard visitor**
- **REST API**

## Connections

- Scrape operator → Manual trigger: triggers (evidence: `apps/api/src/queue/scrape.controller.ts`)
- Scrape scheduler → Scrape producer: starts runs (evidence: `README.md`)
- Manual trigger → Scrape producer: starts run (evidence: `apps/api/src/queue/scrape.controller.ts`)
- Scrape producer → Search queue: enqueues search (evidence: `README.md`)
- Search queue → Search crawler: dispatches (evidence: `README.md`)
- Search crawler → Listing queue: enqueues listings (evidence: `README.md`)
- Search crawler → Search queue: enqueues next page (evidence: `README.md`)
- Listing queue → Listing worker: dispatches (evidence: `README.md`)
- Listing worker → Browser rendering: renders pages (evidence: `README.md`)
- Browser rendering → OnTheMarket: fetches pages (evidence: `README.md`)
- Listing worker → Portal extraction: extracts listing (evidence: `README.md`)
- Listing worker → Listing validation: validates listing (evidence: `README.md`)
- Listing worker → Listing queries and upsert: upserts listing (evidence: `README.md`)
- Listing worker → Run and quality tracker: tracks run quality (evidence: `README.md`)
- Run and quality tracker → Run and health data: finalizes run (evidence: `apps/api/src/queue/run-tracker.service.ts`)
- Listing endpoints → Listing queries and upsert: queries listings (evidence: `apps/api/src/listings/listings.controller.ts`)
- Run endpoints → Run and health data: queries runs (evidence: `apps/api/src/runs/runs.controller.ts`)
- Pipeline health → Run and health data: reads pipeline state (evidence: `apps/api/src/health/health.controller.ts`)
- Listing queries and upsert → Prisma client: queries and writes (evidence: `apps/api/src/listings/listings.service.ts`)
- Run and health data → Prisma client: queries and writes (evidence: `apps/api/src/runs/runs.service.ts`)
- Prisma client → PostgreSQL: persists records (evidence: `apps/api/src/prisma/prisma.service.ts`)
- Dashboard visitor → Listings dashboard: browses (evidence: `README.md`)
- Listings dashboard → Dashboard API client: requests listings and pulse (evidence: `apps/web/app/page.tsx`)
- Property detail → Dashboard API client: requests property (evidence: `apps/web/app/listings/[id]/page.tsx`)
- Health console → Dashboard API client: requests health and runs (evidence: `README.md`)
- Dashboard API client → REST API: calls (evidence: `apps/web/lib/api.ts`)
- REST API → Listing endpoints: routes listing requests (evidence: `README.md`)
- REST API → Run endpoints: routes run requests (evidence: `README.md`)
- REST API → Pipeline health: routes health requests (evidence: `README.md`)
- REST API → Metrics endpoint: serves metrics (evidence: `README.md`)
