# my-hackathon-projects/nestai-agent architecture

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

- Interactive diagram: https://gitdiagram.com/my-hackathon-projects/nestai-agent
- Repository: https://github.com/my-hackathon-projects/nestai-agent

## Overview

NestAI is a voice- and text-driven real-estate discovery assistant. Users choose a location and rent/buy preference, search for listings, review nearby amenities and AI-explained matches, then refine, compare, chat, or revisit saved sessions. The README documents the Dify workflow’s listing, amenity, distance, analysis, and aggregation stages; those workflow internals are external to this repository. The graph includes UI and internal data-handling layers. Some component details are based on the README or source index rather than inspected implementation, so uncertain connections are omitted.

Main entry points: [`src/components/MainLayout.tsx`](https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/components/MainLayout.tsx) (Discovery layout), [`src/hooks/useDify.ts`](https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/hooks/useDify.ts) (AI request handling), [`src/components/LocationPicker.tsx`](https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/components/LocationPicker.tsx) (Location selection), [`src/hooks/useSession.ts`](https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/hooks/useSession.ts) (Session persistence)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Search experience"]
  node_location["Location selection<br/>[LocationPicker.tsx]"]
  node_map_picker["Map picker<br/>[MapPickerModal.tsx]"]
  node_voice_chat["Voice and chat<br/>[ChatBar.tsx]"]
  node_main_layout["Discovery layout<br/>[MainLayout.tsx]"]
  node_settings["Search settings<br/>[SettingsModal.tsx]"]
end

subgraph group_results["Listings and insights"]
  node_map["Listings map<br/>[MainMap.tsx]"]
  node_listing_panel["Listing results<br/>[ListingsPanel.tsx]"]
  node_offer_details["Offer details"]
  node_amenities_panel["Nearby amenities<br/>[AmenitiesPanel.tsx]"]
  node_compare["Property comparison<br/>[CompareModal.tsx]"]
  node_history["Session history<br/>[HistoryDrawer.tsx]"]
end

subgraph group_services["Discovery services"]
  node_nominatim_hook["Geocoding<br/>[useNominatim.ts]"]
  node_nominatim{{"Nominatim"}}
  node_geolocation["Device location<br/>[useGeolocation.ts]"]
  node_listing_hook["Listing retrieval<br/>[useListings.ts]"]
  node_amenity_hook["Amenity lookup<br/>[useAmenities.ts]"]
  node_overpass_proxy["Overpass proxy<br/>[overpass.js]"]
  node_overpass{{"OpenStreetMap Overpass"}}
  node_dify_hook["AI request handling<br/>[useDify.ts]"]
  node_dify_proxy["Dify proxy<br/>[dify.js]"]
  node_normalizers["Response normalization"]
end

subgraph group_state["State and persistence"]
  node_store["Application state<br/>[appStore.ts]"]
  node_session_hook["Session persistence<br/>[useSession.ts]"]
  node_indexeddb[("Browser IndexedDB")]
end

subgraph group_workflow["AI workflow"]
  node_dify_workflow{{"Dify workflow"}}
  node_stream_estate{{"Stream Estate listings"}}
  node_workflow_amenities["Amenity search"]
  node_distance["Distance calculation<br/>[geo.ts]"]
  node_property_analysis["Match analysis"]
  node_aggregation["Result aggregation"]
end

node_user(("Home seeker"))

node_user -->|"chooses location"| node_location
node_user -->|"describes needs"| node_voice_chat
node_location -->|"searches places"| node_nominatim_hook
node_nominatim_hook -->|"geocodes"| node_nominatim
node_map_picker -->|"reverse geocodes"| node_nominatim_hook
node_location -->|"uses location"| node_geolocation
node_main_layout -->|"renders"| node_map
node_main_layout -->|"renders"| node_listing_panel
node_main_layout -->|"renders"| node_offer_details
node_main_layout -->|"renders"| node_amenities_panel
node_main_layout -->|"renders"| node_voice_chat
node_listing_panel -->|"compares listings"| node_compare
node_user -->|"requests listings"| node_listing_hook
node_listing_hook -.->|"requests AI search"| node_dify_hook
node_dify_hook -->|"posts request"| node_dify_proxy
node_dify_proxy -->|"forwards request"| node_dify_workflow
node_dify_workflow -->|"retrieves listings"| node_stream_estate
node_dify_workflow -->|"searches nearby"| node_workflow_amenities
node_workflow_amenities -->|"calculates walking distance"| node_distance
node_distance -->|"provides distances"| node_property_analysis
node_property_analysis -->|"provides scored matches"| node_aggregation
node_aggregation -->|"returns results"| node_dify_workflow
node_dify_hook -->|"normalizes responses"| node_normalizers
node_dify_hook -->|"updates results"| node_store
node_user -->|"checks neighbourhood"| node_amenity_hook
node_amenity_hook -.->|"queries amenities"| node_overpass_proxy
node_overpass_proxy -->|"proxies query"| node_overpass
node_user -->|"reopens session"| node_history
node_history -->|"loads saved session"| node_session_hook
node_session_hook -->|"reads and writes"| node_indexeddb
node_session_hook -->|"restores state"| node_store
node_user -->|"refines preferences"| node_settings
node_settings -->|"updates preferences"| node_store

click node_location "https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/components/LocationPicker.tsx"
click node_map_picker "https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/components/MapPickerModal.tsx"
click node_voice_chat "https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/components/ChatBar.tsx"
click node_main_layout "https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/components/MainLayout.tsx"
click node_map "https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/components/MainMap.tsx"
click node_listing_panel "https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/components/ListingsPanel.tsx"
click node_offer_details "https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/components/OfferDetailsPanel.tsx"
click node_amenities_panel "https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/components/AmenitiesPanel.tsx"
click node_compare "https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/components/CompareModal.tsx"
click node_history "https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/components/HistoryDrawer.tsx"
click node_settings "https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/components/SettingsModal.tsx"
click node_nominatim_hook "https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/hooks/useNominatim.ts"
click node_geolocation "https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/hooks/useGeolocation.ts"
click node_listing_hook "https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/hooks/useListings.ts"
click node_amenity_hook "https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/hooks/useAmenities.ts"
click node_overpass_proxy "https://github.com/my-hackathon-projects/nestai-agent/blob/main/api/overpass.js"
click node_dify_hook "https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/hooks/useDify.ts"
click node_dify_proxy "https://github.com/my-hackathon-projects/nestai-agent/blob/main/api/dify.js"
click node_distance "https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/lib/geo.ts"
click node_normalizers "https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/lib/dify-normalizers.ts"
click node_store "https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/store/appStore.ts"
click node_session_hook "https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/hooks/useSession.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_location,node_map_picker,node_voice_chat,node_main_layout,node_settings toneBlue
class node_map,node_listing_panel,node_offer_details,node_amenities_panel,node_compare,node_history toneAmber
class node_nominatim_hook,node_nominatim,node_geolocation,node_listing_hook,node_amenity_hook,node_overpass_proxy,node_overpass,node_dify_hook,node_dify_proxy,node_normalizers toneMint
class node_store,node_session_hook,node_indexeddb toneRose
class node_dify_workflow,node_stream_estate,node_workflow_amenities,node_distance,node_property_analysis,node_aggregation,node_user toneIndigo
```

## Components

### Search experience

- [Location selection](https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/components/LocationPicker.tsx): `src/components/LocationPicker.tsx`
- [Map picker](https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/components/MapPickerModal.tsx): `src/components/MapPickerModal.tsx`
- [Voice and chat](https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/components/ChatBar.tsx): `src/components/ChatBar.tsx`
- [Discovery layout](https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/components/MainLayout.tsx): `src/components/MainLayout.tsx`
- [Search settings](https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/components/SettingsModal.tsx): `src/components/SettingsModal.tsx`

### Listings and insights

- [Listings map](https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/components/MainMap.tsx): `src/components/MainMap.tsx`
- [Listing results](https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/components/ListingsPanel.tsx): `src/components/ListingsPanel.tsx`
- [Offer details](https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/components/OfferDetailsPanel.tsx): `src/components/OfferDetailsPanel.tsx`
- [Nearby amenities](https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/components/AmenitiesPanel.tsx): `src/components/AmenitiesPanel.tsx`
- [Property comparison](https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/components/CompareModal.tsx): `src/components/CompareModal.tsx`
- [Session history](https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/components/HistoryDrawer.tsx): `src/components/HistoryDrawer.tsx`

### Discovery services

- [Geocoding](https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/hooks/useNominatim.ts): `src/hooks/useNominatim.ts`
- **Nominatim**
- [Device location](https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/hooks/useGeolocation.ts): `src/hooks/useGeolocation.ts`
- [Listing retrieval](https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/hooks/useListings.ts): `src/hooks/useListings.ts`
- [Amenity lookup](https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/hooks/useAmenities.ts): `src/hooks/useAmenities.ts`
- [Overpass proxy](https://github.com/my-hackathon-projects/nestai-agent/blob/main/api/overpass.js): `api/overpass.js`
- **OpenStreetMap Overpass**
- [AI request handling](https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/hooks/useDify.ts): `src/hooks/useDify.ts`
- [Dify proxy](https://github.com/my-hackathon-projects/nestai-agent/blob/main/api/dify.js): `api/dify.js`
- [Response normalization](https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/lib/dify-normalizers.ts): `src/lib/dify-normalizers.ts`

### State and persistence

- [Application state](https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/store/appStore.ts): `src/store/appStore.ts`
- [Session persistence](https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/hooks/useSession.ts): `src/hooks/useSession.ts`
- **Browser IndexedDB**

### AI workflow

- **Dify workflow**
- **Stream Estate listings**
- **Amenity search**
- [Distance calculation](https://github.com/my-hackathon-projects/nestai-agent/blob/main/src/lib/geo.ts): `src/lib/geo.ts`
- **Match analysis**
- **Result aggregation**

### Other components

- **Home seeker**

## Connections

- Home seeker → Location selection: chooses location (evidence: `README.md`)
- Home seeker → Voice and chat: describes needs (evidence: `README.md`)
- Location selection → Geocoding: searches places (evidence: `src/components/LocationPicker.tsx`)
- Geocoding → Nominatim: geocodes (evidence: `src/hooks/useNominatim.ts`)
- Map picker → Geocoding: reverse geocodes (evidence: `src/components/MapPickerModal.tsx`)
- Location selection → Device location: uses location (evidence: `src/components/LocationPicker.tsx`)
- Discovery layout → Listings map: renders (evidence: `src/components/MainLayout.tsx`)
- Discovery layout → Listing results: renders (evidence: `src/components/MainLayout.tsx`)
- Discovery layout → Offer details: renders (evidence: `src/components/MainLayout.tsx`)
- Discovery layout → Nearby amenities: renders (evidence: `src/components/MainLayout.tsx`)
- Discovery layout → Voice and chat: renders (evidence: `src/components/MainLayout.tsx`)
- Listing results → Property comparison: compares listings (evidence: `README.md`)
- Home seeker → Listing retrieval: requests listings (evidence: `README.md`)
- Listing retrieval → AI request handling: requests AI search
- AI request handling → Dify proxy: posts request (evidence: `README.md`)
- Dify proxy → Dify workflow: forwards request (evidence: `README.md`)
- Dify workflow → Stream Estate listings: retrieves listings (evidence: `README.md`)
- Dify workflow → Amenity search: searches nearby (evidence: `README.md`)
- Amenity search → Distance calculation: calculates walking distance (evidence: `README.md`)
- Distance calculation → Match analysis: provides distances (evidence: `README.md`)
- Match analysis → Result aggregation: provides scored matches (evidence: `README.md`)
- Result aggregation → Dify workflow: returns results (evidence: `README.md`)
- AI request handling → Response normalization: normalizes responses (evidence: `src/hooks/useDify.ts`)
- AI request handling → Application state: updates results (evidence: `src/hooks/useDify.ts`)
- Home seeker → Amenity lookup: checks neighbourhood (evidence: `README.md`)
- Amenity lookup → Overpass proxy: queries amenities
- Overpass proxy → OpenStreetMap Overpass: proxies query (evidence: `README.md`)
- Home seeker → Session history: reopens session (evidence: `README.md`)
- Session history → Session persistence: loads saved session (evidence: `src/components/HistoryDrawer.tsx`)
- Session persistence → Browser IndexedDB: reads and writes (evidence: `src/hooks/useSession.ts`)
- Session persistence → Application state: restores state (evidence: `src/hooks/useSession.ts`)
- Home seeker → Search settings: refines preferences (evidence: `README.md`)
- Search settings → Application state: updates preferences (evidence: `src/components/SettingsModal.tsx`)
