# abdullah-zeshan/home-guardian architecture

> Architecture diagram of the GitHub repository abdullah-zeshan/home-guardian, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/abdullah-zeshan/home-guardian
- Repository: https://github.com/abdullah-zeshan/home-guardian

## Overview

Home Guardian is a homeowner guidance app with three main paths: immediate issue triage, AI-assisted inspection-report reading, and a guided home-condition questionnaire that saves and exports a report. The questionnaire also offers photo-based autofill; the README describes that capability as coming soon. The sampled sources show the analyzer’s Gemini calls and the report-save client, but do not show the questionnaire’s photo-request or PDF-to-analyzer handoff implementation, so those documented links are marked dashed.

Main entry points: [`src/app/create-report/page.js`](https://github.com/abdullah-zeshan/home-guardian/blob/master/src/app/create-report/page.js) (Home survey), [`src/app/page.js`](https://github.com/abdullah-zeshan/home-guardian/blob/master/src/app/page.js) (Home screen), [`src/app/report/page.js`](https://github.com/abdullah-zeshan/home-guardian/blob/master/src/app/report/page.js) (Report upload), [`src/app/api/analyze/route.js`](https://github.com/abdullah-zeshan/home-guardian/blob/master/src/app/api/analyze/route.js) (PDF analysis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Homeowner entry"]
  node_home["Home screen<br/>[page.js]"]
end

subgraph group_guidance["Home guidance"]
  node_emergency["Issue triage<br/>[page.js]"]
end

subgraph group_reports["Report workflows"]
  node_report_upload["Report upload<br/>[page.js]"]
  node_report_analysis["PDF analysis<br/>[route.js]"]
  node_report_results["Prioritized findings<br/>[page.js]"]
  node_questionnaire["Home survey<br/>[page.js]"]
  node_photo_capture["Photo autofill<br/>[page.js]"]
  node_photo_analysis["Photo analysis<br/>[route.js]"]
  node_saved_reports[("Report records<br/>[supabase.js]")]
  node_downloadable_report["PDF report<br/>[page.js]"]
end

subgraph group_services["External services"]
  node_gemini{{"Gemini API"}}
  node_supabase_service[("Supabase")]
end

node_homeowner(("Homeowner"))

node_homeowner -->|"opens"| node_home
node_home -->|"links to"| node_emergency
node_home -->|"links to"| node_report_upload
node_home -->|"links to"| node_questionnaire
node_homeowner -->|"selects issue"| node_emergency
node_emergency -->|"shows guidance"| node_homeowner
node_homeowner -->|"uploads PDF"| node_report_upload
node_report_upload -->|"posts file"| node_report_analysis
node_report_analysis -->|"analyzes PDF"| node_gemini
node_report_analysis -->|"returns findings"| node_report_results
node_report_results -->|"displays priorities"| node_homeowner
node_homeowner -->|"enters answers"| node_questionnaire
node_questionnaire -->|"inserts findings"| node_saved_reports
node_saved_reports -->|"uses client"| node_supabase_service
node_questionnaire -->|"builds PDF"| node_downloadable_report
node_downloadable_report -->|"downloads"| node_homeowner
node_homeowner -->|"provides photo"| node_photo_capture
node_photo_capture -.->|"autofills via"| node_photo_analysis
node_photo_analysis -->|"analyzes image"| node_gemini
node_questionnaire -.->|"offers analysis"| node_report_upload

click node_home "https://github.com/abdullah-zeshan/home-guardian/blob/master/src/app/page.js"
click node_emergency "https://github.com/abdullah-zeshan/home-guardian/blob/master/src/app/emergency/page.js"
click node_report_upload "https://github.com/abdullah-zeshan/home-guardian/blob/master/src/app/report/page.js"
click node_report_analysis "https://github.com/abdullah-zeshan/home-guardian/blob/master/src/app/api/analyze/route.js"
click node_report_results "https://github.com/abdullah-zeshan/home-guardian/blob/master/src/app/report/page.js"
click node_questionnaire "https://github.com/abdullah-zeshan/home-guardian/blob/master/src/app/create-report/page.js"
click node_photo_capture "https://github.com/abdullah-zeshan/home-guardian/blob/master/src/app/create-report/page.js"
click node_photo_analysis "https://github.com/abdullah-zeshan/home-guardian/blob/master/src/app/api/analyze-photo/route.js"
click node_saved_reports "https://github.com/abdullah-zeshan/home-guardian/blob/master/src/lib/supabase.js"
click node_downloadable_report "https://github.com/abdullah-zeshan/home-guardian/blob/master/src/app/create-report/page.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_home toneBlue
class node_emergency toneAmber
class node_report_upload,node_report_analysis,node_report_results,node_questionnaire,node_photo_capture,node_photo_analysis,node_saved_reports,node_downloadable_report toneMint
class node_gemini,node_supabase_service toneRose
class node_homeowner toneIndigo
```

## Components

### Homeowner entry

- [Home screen](https://github.com/abdullah-zeshan/home-guardian/blob/master/src/app/page.js): `src/app/page.js`

### Home guidance

- [Issue triage](https://github.com/abdullah-zeshan/home-guardian/blob/master/src/app/emergency/page.js): `src/app/emergency/page.js`

### Report workflows

- [Report upload](https://github.com/abdullah-zeshan/home-guardian/blob/master/src/app/report/page.js): `src/app/report/page.js`
- [PDF analysis](https://github.com/abdullah-zeshan/home-guardian/blob/master/src/app/api/analyze/route.js): `src/app/api/analyze/route.js`
- [Prioritized findings](https://github.com/abdullah-zeshan/home-guardian/blob/master/src/app/report/page.js): `src/app/report/page.js`
- [Home survey](https://github.com/abdullah-zeshan/home-guardian/blob/master/src/app/create-report/page.js): `src/app/create-report/page.js`
- [Photo autofill](https://github.com/abdullah-zeshan/home-guardian/blob/master/src/app/create-report/page.js): `src/app/create-report/page.js`
- [Photo analysis](https://github.com/abdullah-zeshan/home-guardian/blob/master/src/app/api/analyze-photo/route.js): `src/app/api/analyze-photo/route.js`
- [Report records](https://github.com/abdullah-zeshan/home-guardian/blob/master/src/lib/supabase.js): `src/lib/supabase.js`
- [PDF report](https://github.com/abdullah-zeshan/home-guardian/blob/master/src/app/create-report/page.js): `src/app/create-report/page.js`

### External services

- **Gemini API**
- **Supabase**

### Other components

- **Homeowner**

## Connections

- Homeowner → Home screen: opens (evidence: `src/app/page.js`)
- Home screen → Issue triage: links to (evidence: `src/app/page.js`)
- Home screen → Report upload: links to (evidence: `src/app/page.js`)
- Home screen → Home survey: links to (evidence: `src/app/page.js`)
- Homeowner → Issue triage: selects issue (evidence: `src/app/emergency/page.js`)
- Issue triage → Homeowner: shows guidance (evidence: `src/app/emergency/page.js`)
- Homeowner → Report upload: uploads PDF (evidence: `src/app/report/page.js`)
- Report upload → PDF analysis: posts file (evidence: `src/app/report/page.js`)
- PDF analysis → Gemini API: analyzes PDF (evidence: `src/app/api/analyze/route.js`)
- PDF analysis → Prioritized findings: returns findings (evidence: `src/app/report/page.js`)
- Prioritized findings → Homeowner: displays priorities (evidence: `src/app/report/page.js`)
- Homeowner → Home survey: enters answers (evidence: `src/app/create-report/page.js`)
- Home survey → Report records: inserts findings (evidence: `src/app/create-report/page.js`)
- Report records → Supabase: uses client (evidence: `src/lib/supabase.js`)
- Home survey → PDF report: builds PDF (evidence: `src/app/create-report/page.js`)
- PDF report → Homeowner: downloads (evidence: `src/app/create-report/page.js`)
- Homeowner → Photo autofill: provides photo (evidence: `src/app/create-report/page.js`)
- Photo autofill → Photo analysis: autofills via
- Photo analysis → Gemini API: analyzes image (evidence: `src/app/api/analyze-photo/route.js`)
- Home survey → Report upload: offers analysis (evidence: `README.md`)
