# harifaka/house-hunt architecture

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

- Interactive diagram: https://gitdiagram.com/harifaka/house-hunt
- Repository: https://github.com/harifaka/house-hunt

## Overview

House Hunt is a bilingual property-inspection and research web app. A user manages a house, completes a weighted inspection with saved answers and photos, then reviews scores or exports a report; the property finder adds listing and city research. The graph includes the documented calculator, AI-analysis, and collaboration capabilities. Source excerpts establish several route-to-service calls; README statements support documented storage and product flows. Unsampled routes and integrations are represented only where their relationships are documented or visible in the source index.

Main entry points: [`app.js`](https://github.com/harifaka/house-hunt/blob/main/app.js) (Express app), [`src/database.js`](https://github.com/harifaka/house-hunt/blob/main/src/database.js) (D1 access layer), [`src/routes/home.js`](https://github.com/harifaka/house-hunt/blob/main/src/routes/home.js) (House management), [`src/routes/quiz.js`](https://github.com/harifaka/house-hunt/blob/main/src/routes/quiz.js) (Inspection workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web experience"]
  node_server["Express app<br/>[app.js]"]
  node_screens["Web screens"]
  node_legal["Legal pages<br/>[legal.js]"]
end

subgraph group_inspection["House inspections"]
  node_houses["House management<br/>[home.js]"]
  node_quiz["Inspection workflow<br/>[quiz.js]"]
  node_questionbank["Question scoring<br/>[questions.js]"]
  node_api["House and export API<br/>[api.js]"]
  node_admin["Admin and reports<br/>[admin.js]"]
  node_images["Image handling<br/>[image-service.js]"]
end

subgraph group_research["Property research"]
  node_finder["Property finder<br/>[property-finder.js]"]
  node_scraper["Listing scraper<br/>[scraper.js]"]
  node_calculators["Energy and heating<br/>[calculators.js]"]
  node_listing(("Listing websites"))
end

subgraph group_platform["Services and storage"]
  node_ai["AI analysis<br/>[ai-service.js]"]
  node_database["D1 access layer<br/>[database.js]"]
  node_d1[("Cloudflare D1")]
  node_r2[("Cloudflare R2")]
  node_llm(("Vision and AI provider"))
  node_logger["Audit logging<br/>[logger.js]"]
end

node_user(("House hunter"))

node_user -->|"uses"| node_server
node_server -->|"mounts"| node_houses
node_server -->|"mounts"| node_quiz
node_server -->|"mounts"| node_api
node_server -->|"dispatches"| node_admin
node_server -->|"mounts"| node_calculators
node_server -->|"mounts"| node_finder
node_server -->|"mounts"| node_legal
node_houses -.->|"renders"| node_screens
node_quiz -.->|"renders"| node_screens
node_houses -->|"reads and writes"| node_database
node_houses -->|"scores with"| node_questionbank
node_houses -->|"uploads and deletes"| node_images
node_quiz -->|"reads and writes"| node_database
node_quiz -->|"scores with"| node_questionbank
node_quiz -->|"uploads to"| node_images
node_api -->|"reads and writes"| node_database
node_api -->|"uses scoring"| node_questionbank
node_api -->|"invokes"| node_ai
node_admin -->|"uses"| node_database
node_admin -->|"uses"| node_questionbank
node_finder -->|"scrapes and searches"| node_scraper
node_finder -->|"reads and writes"| node_database
node_finder -->|"requests analysis"| node_ai
node_listing -.->|"provides listings"| node_scraper
node_calculators -->|"reads and writes"| node_database
node_calculators -->|"requests analysis"| node_ai
node_images -->|"stores photos"| node_r2
node_ai -->|"loads and saves"| node_database
node_ai -->|"sends analysis"| node_llm
node_database -->|"queries over HTTPS"| node_d1
node_logger -->|"persists audit logs"| node_database
node_houses -.->|"audits activity"| node_logger
node_quiz -.->|"audits activity"| node_logger

click node_server "https://github.com/harifaka/house-hunt/blob/main/app.js"
click node_screens "https://github.com/harifaka/house-hunt/tree/main/views"
click node_houses "https://github.com/harifaka/house-hunt/blob/main/src/routes/home.js"
click node_quiz "https://github.com/harifaka/house-hunt/blob/main/src/routes/quiz.js"
click node_questionbank "https://github.com/harifaka/house-hunt/blob/main/src/questions.js"
click node_api "https://github.com/harifaka/house-hunt/blob/main/src/routes/api.js"
click node_admin "https://github.com/harifaka/house-hunt/blob/main/src/routes/admin.js"
click node_images "https://github.com/harifaka/house-hunt/blob/main/src/image-service.js"
click node_finder "https://github.com/harifaka/house-hunt/blob/main/src/routes/property-finder.js"
click node_scraper "https://github.com/harifaka/house-hunt/blob/main/src/scraper.js"
click node_calculators "https://github.com/harifaka/house-hunt/blob/main/src/routes/calculators.js"
click node_legal "https://github.com/harifaka/house-hunt/blob/main/src/routes/legal.js"
click node_ai "https://github.com/harifaka/house-hunt/blob/main/src/ai-service.js"
click node_database "https://github.com/harifaka/house-hunt/blob/main/src/database.js"
click node_logger "https://github.com/harifaka/house-hunt/blob/main/src/logger.js"

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_server,node_screens,node_legal toneBlue
class node_houses,node_quiz,node_questionbank,node_api,node_admin,node_images toneAmber
class node_finder,node_scraper,node_calculators,node_listing toneMint
class node_ai,node_database,node_d1,node_r2,node_llm,node_logger toneRose
class node_user toneIndigo
```

## Components

### Web experience

- [Express app](https://github.com/harifaka/house-hunt/blob/main/app.js): `app.js`
- [Web screens](https://github.com/harifaka/house-hunt/tree/main/views): `views`
- [Legal pages](https://github.com/harifaka/house-hunt/blob/main/src/routes/legal.js): `src/routes/legal.js`

### House inspections

- [House management](https://github.com/harifaka/house-hunt/blob/main/src/routes/home.js): `src/routes/home.js`
- [Inspection workflow](https://github.com/harifaka/house-hunt/blob/main/src/routes/quiz.js): `src/routes/quiz.js`
- [Question scoring](https://github.com/harifaka/house-hunt/blob/main/src/questions.js): `src/questions.js`
- [House and export API](https://github.com/harifaka/house-hunt/blob/main/src/routes/api.js): `src/routes/api.js`
- [Admin and reports](https://github.com/harifaka/house-hunt/blob/main/src/routes/admin.js): `src/routes/admin.js`
- [Image handling](https://github.com/harifaka/house-hunt/blob/main/src/image-service.js): `src/image-service.js`

### Property research

- [Property finder](https://github.com/harifaka/house-hunt/blob/main/src/routes/property-finder.js): `src/routes/property-finder.js`
- [Listing scraper](https://github.com/harifaka/house-hunt/blob/main/src/scraper.js): `src/scraper.js`
- [Energy and heating](https://github.com/harifaka/house-hunt/blob/main/src/routes/calculators.js): `src/routes/calculators.js`
- **Listing websites**

### Services and storage

- [AI analysis](https://github.com/harifaka/house-hunt/blob/main/src/ai-service.js): `src/ai-service.js`
- [D1 access layer](https://github.com/harifaka/house-hunt/blob/main/src/database.js): `src/database.js`
- **Cloudflare D1**
- **Cloudflare R2**
- **Vision and AI provider**
- [Audit logging](https://github.com/harifaka/house-hunt/blob/main/src/logger.js): `src/logger.js`

### Other components

- **House hunter**

## Connections

- House hunter → Express app: uses (evidence: `README.md`)
- Express app → House management: mounts (evidence: `app.js`)
- Express app → Inspection workflow: mounts (evidence: `app.js`)
- Express app → House and export API: mounts (evidence: `app.js`)
- Express app → Admin and reports: dispatches (evidence: `app.js`)
- Express app → Energy and heating: mounts (evidence: `app.js`)
- Express app → Property finder: mounts (evidence: `app.js`)
- Express app → Legal pages: mounts (evidence: `app.js`)
- House management → Web screens: renders
- Inspection workflow → Web screens: renders
- House management → D1 access layer: reads and writes (evidence: `src/routes/home.js`)
- House management → Question scoring: scores with (evidence: `src/routes/home.js`)
- House management → Image handling: uploads and deletes (evidence: `src/routes/home.js`)
- Inspection workflow → D1 access layer: reads and writes (evidence: `src/routes/quiz.js`)
- Inspection workflow → Question scoring: scores with (evidence: `src/routes/quiz.js`)
- Inspection workflow → Image handling: uploads to (evidence: `src/routes/quiz.js`)
- House and export API → D1 access layer: reads and writes (evidence: `src/routes/api.js`)
- House and export API → Question scoring: uses scoring (evidence: `src/routes/api.js`)
- House and export API → AI analysis: invokes (evidence: `src/routes/api.js`)
- Admin and reports → D1 access layer: uses (evidence: `src/routes/admin.js`)
- Admin and reports → Question scoring: uses (evidence: `src/routes/admin.js`)
- Property finder → Listing scraper: scrapes and searches (evidence: `src/routes/property-finder.js`)
- Property finder → D1 access layer: reads and writes (evidence: `src/routes/property-finder.js`)
- Property finder → AI analysis: requests analysis (evidence: `src/routes/property-finder.js`)
- Listing websites → Listing scraper: provides listings
- Energy and heating → D1 access layer: reads and writes (evidence: `src/routes/calculators.js`)
- Energy and heating → AI analysis: requests analysis (evidence: `src/routes/calculators.js`)
- Image handling → Cloudflare R2: stores photos (evidence: `src/image-service.js`)
- AI analysis → D1 access layer: loads and saves (evidence: `src/ai-service.js`)
- AI analysis → Vision and AI provider: sends analysis (evidence: `src/ai-service.js`)
- D1 access layer → Cloudflare D1: queries over HTTPS (evidence: `README.md`)
- Audit logging → D1 access layer: persists audit logs (evidence: `src/logger.js`)
- House management → Audit logging: audits activity (evidence: `src/routes/home.js`)
- Inspection workflow → Audit logging: audits activity (evidence: `src/routes/quiz.js`)
