# rakesh-0804/propai architecture

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

- Interactive diagram: https://gitdiagram.com/rakesh-0804/propai
- Repository: https://github.com/rakesh-0804/propai

## Overview

PropAI Estate is a role-based real-estate marketplace. Buyers browse and compare listings, use AI-assisted search and financial analysis, save properties, contact sellers, and schedule self-guided visits; sellers manage listings and admins oversee verification and market activity. The graph preserves the documented AI, due-diligence, tour, and portal capabilities. Source excerpts confirm selected API-to-service and persistence calls; several UI and capability links are documented in the README, while unsampled implementations are represented only at paths present in the tree.

Main entry points: [`src/lib/db.ts`](https://github.com/rakesh-0804/propai/blob/main/src/lib/db.ts) (Application Database), [`src/app/api/properties/route.ts`](https://github.com/rakesh-0804/propai/blob/main/src/app/api/properties/route.ts) (Property API), [`src/app/api/visits/route.ts`](https://github.com/rakesh-0804/propai/blob/main/src/app/api/visits/route.ts) (Site Visits API), [`src/lib/auth.ts`](https://github.com/rakesh-0804/propai/blob/main/src/lib/auth.ts) (Authentication)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_marketplace["Marketplace"]
  node_property_browse["Property Browsing<br/>[page.tsx]"]
  node_property_detail["Property Detail<br/>[page.tsx]"]
  node_property_api["Property API<br/>[route.ts]"]
  node_wishlist_api["Saved Properties<br/>[route.ts]"]
  node_enquiry_api["Enquiries<br/>[route.ts]"]
end

subgraph group_intelligence["AI &amp; Analysis"]
  node_search_ui["NLP Search<br/>[AINLPSearchBar.tsx]"]
  node_search_api["Semantic Search API<br/>[route.ts]"]
  node_match_scoring["Match Scoring<br/>[matchScorer.ts]"]
  node_price_estimation["Price Estimation<br/>[priceEstimator.ts]"]
  node_compare_ui["Property Comparison<br/>[CompareMatrix.tsx]"]
  node_compare_engine["Comparison Metrics<br/>[compareEngine.ts]"]
  node_underwriting_api["Underwriting API<br/>[route.ts]"]
  node_underwriting_service["Financial Underwriting"]
  node_underwriting_ui["Investment Calculator"]
  node_fraud_detection["Listing Fraud Detection"]
  node_floorplan_api["Floor Plan API<br/>[route.ts]"]
  node_floorplan_generator["Floor Plan Generation"]
  node_floorplan_viewer["3D Floor Plan Viewer"]
end

subgraph group_portals["Role Portals"]
  node_seller_portal["Seller Portal<br/>[page.tsx]"]
  node_admin_portal["Admin Dashboard<br/>[page.tsx]"]
end

subgraph group_visits["Visits &amp; Access"]
  node_visits_api["Site Visits API<br/>[route.ts]"]
  node_lock_gateway["Smart Lock Gateway"]
  node_virtual_tours["360° Virtual Tours"]
end

subgraph group_platform["Identity &amp; Data"]
  node_auth_service["Authentication<br/>[auth.ts]"]
  node_database[("Application Database<br/>[db.ts]")]
end

node_buyer(("Buyer"))
node_seller(("Seller"))
node_admin(("Administrator"))

node_buyer -->|"browses listings"| node_property_browse
node_property_browse -.->|"requests listings"| node_property_api
node_property_api -->|"reads and writes"| node_database
node_property_api -->|"scores matches"| node_match_scoring
node_property_api -->|"estimates prices"| node_price_estimation
node_buyer -->|"searches naturally"| node_search_ui
node_search_ui -.->|"submits query"| node_search_api
node_buyer -.->|"views listing"| node_property_detail
node_buyer -->|"compares homes"| node_compare_ui
node_compare_ui -->|"computes metrics"| node_compare_engine
node_buyer -->|"evaluates investment"| node_underwriting_ui
node_underwriting_ui -.->|"requests analysis"| node_underwriting_api
node_underwriting_api -->|"generates report"| node_underwriting_service
node_underwriting_service -->|"reads property; stores report"| node_database
node_buyer -.->|"saves properties"| node_wishlist_api
node_wishlist_api -->|"reads and updates"| node_database
node_buyer -.->|"contacts seller"| node_enquiry_api
node_enquiry_api -->|"stores enquiry; notifies"| node_database
node_seller -->|"manages listings"| node_seller_portal
node_admin -->|"reviews marketplace"| node_admin_portal
node_admin_portal -.->|"checks listings"| node_fraud_detection
node_buyer -.->|"requests floor plan"| node_floorplan_api
node_floorplan_api -->|"generates layout"| node_floorplan_generator
node_floorplan_viewer -.->|"renders generated plans"| node_floorplan_generator
node_buyer -->|"schedules tour"| node_visits_api
node_visits_api -->|"stores visit"| node_database
node_visits_api -->|"generates access PIN"| node_lock_gateway
node_buyer -->|"views panorama"| node_virtual_tours
node_property_detail -.->|"presents property tour"| node_virtual_tours
node_auth_service -->|"loads user"| node_database
node_property_api -->|"checks current user"| node_auth_service
node_visits_api -->|"checks current user"| node_auth_service
node_lock_gateway -->|"updates access records"| node_database

click node_property_browse "https://github.com/rakesh-0804/propai/blob/main/src/app/properties/page.tsx"
click node_property_detail "https://github.com/rakesh-0804/propai/blob/main/src/app/properties/%5Bid%5D/page.tsx"
click node_property_api "https://github.com/rakesh-0804/propai/blob/main/src/app/api/properties/route.ts"
click node_wishlist_api "https://github.com/rakesh-0804/propai/blob/main/src/app/api/wishlist/route.ts"
click node_enquiry_api "https://github.com/rakesh-0804/propai/blob/main/src/app/api/enquiries/route.ts"
click node_search_ui "https://github.com/rakesh-0804/propai/blob/main/src/components/AINLPSearchBar.tsx"
click node_search_api "https://github.com/rakesh-0804/propai/blob/main/src/app/api/ai/nlp-search/route.ts"
click node_match_scoring "https://github.com/rakesh-0804/propai/blob/main/src/lib/ai/matchScorer.ts"
click node_price_estimation "https://github.com/rakesh-0804/propai/blob/main/src/lib/ai/priceEstimator.ts"
click node_compare_ui "https://github.com/rakesh-0804/propai/blob/main/src/components/CompareMatrix.tsx"
click node_compare_engine "https://github.com/rakesh-0804/propai/blob/main/src/lib/ai/compareEngine.ts"
click node_underwriting_api "https://github.com/rakesh-0804/propai/blob/main/src/app/api/ai/underwriting/route.ts"
click node_underwriting_service "https://github.com/rakesh-0804/propai/blob/main/src/lib/ai/underwritingService.ts"
click node_underwriting_ui "https://github.com/rakesh-0804/propai/blob/main/src/components/UnderwritingCalculator.tsx"
click node_fraud_detection "https://github.com/rakesh-0804/propai/blob/main/src/lib/ai/duplicateDetector.ts"
click node_floorplan_api "https://github.com/rakesh-0804/propai/blob/main/src/app/api/ai/floor-plan/route.ts"
click node_floorplan_generator "https://github.com/rakesh-0804/propai/blob/main/src/lib/ai/floorPlanGenerator.ts"
click node_floorplan_viewer "https://github.com/rakesh-0804/propai/blob/main/src/components/FloorPlan3DViewer.tsx"
click node_seller_portal "https://github.com/rakesh-0804/propai/blob/main/src/app/dashboard/seller/page.tsx"
click node_admin_portal "https://github.com/rakesh-0804/propai/blob/main/src/app/dashboard/admin/page.tsx"
click node_visits_api "https://github.com/rakesh-0804/propai/blob/main/src/app/api/visits/route.ts"
click node_lock_gateway "https://github.com/rakesh-0804/propai/blob/main/src/lib/iot/smartLockGateway.ts"
click node_virtual_tours "https://github.com/rakesh-0804/propai/blob/main/src/components/VirtualTourViewer.tsx"
click node_auth_service "https://github.com/rakesh-0804/propai/blob/main/src/lib/auth.ts"
click node_database "https://github.com/rakesh-0804/propai/blob/main/src/lib/db.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_property_browse,node_property_detail,node_property_api,node_wishlist_api,node_enquiry_api toneBlue
class node_search_ui,node_search_api,node_match_scoring,node_price_estimation,node_compare_ui,node_compare_engine,node_underwriting_api,node_underwriting_service,node_underwriting_ui,node_fraud_detection,node_floorplan_api,node_floorplan_generator,node_floorplan_viewer toneAmber
class node_seller_portal,node_admin_portal toneMint
class node_visits_api,node_lock_gateway,node_virtual_tours toneRose
class node_auth_service,node_database,node_buyer,node_seller,node_admin toneIndigo
```

## Components

### Marketplace

- [Property Browsing](https://github.com/rakesh-0804/propai/blob/main/src/app/properties/page.tsx): `src/app/properties/page.tsx`
- [Property Detail](https://github.com/rakesh-0804/propai/blob/main/src/app/properties/%5Bid%5D/page.tsx): `src/app/properties/[id]/page.tsx`
- [Property API](https://github.com/rakesh-0804/propai/blob/main/src/app/api/properties/route.ts): `src/app/api/properties/route.ts`
- [Saved Properties](https://github.com/rakesh-0804/propai/blob/main/src/app/api/wishlist/route.ts): `src/app/api/wishlist/route.ts`
- [Enquiries](https://github.com/rakesh-0804/propai/blob/main/src/app/api/enquiries/route.ts): `src/app/api/enquiries/route.ts`

### AI & Analysis

- [NLP Search](https://github.com/rakesh-0804/propai/blob/main/src/components/AINLPSearchBar.tsx): `src/components/AINLPSearchBar.tsx`
- [Semantic Search API](https://github.com/rakesh-0804/propai/blob/main/src/app/api/ai/nlp-search/route.ts): `src/app/api/ai/nlp-search/route.ts`
- [Match Scoring](https://github.com/rakesh-0804/propai/blob/main/src/lib/ai/matchScorer.ts): `src/lib/ai/matchScorer.ts`
- [Price Estimation](https://github.com/rakesh-0804/propai/blob/main/src/lib/ai/priceEstimator.ts): `src/lib/ai/priceEstimator.ts`
- [Property Comparison](https://github.com/rakesh-0804/propai/blob/main/src/components/CompareMatrix.tsx): `src/components/CompareMatrix.tsx`
- [Comparison Metrics](https://github.com/rakesh-0804/propai/blob/main/src/lib/ai/compareEngine.ts): `src/lib/ai/compareEngine.ts`
- [Underwriting API](https://github.com/rakesh-0804/propai/blob/main/src/app/api/ai/underwriting/route.ts): `src/app/api/ai/underwriting/route.ts`
- [Financial Underwriting](https://github.com/rakesh-0804/propai/blob/main/src/lib/ai/underwritingService.ts): `src/lib/ai/underwritingService.ts`
- [Investment Calculator](https://github.com/rakesh-0804/propai/blob/main/src/components/UnderwritingCalculator.tsx): `src/components/UnderwritingCalculator.tsx`
- [Listing Fraud Detection](https://github.com/rakesh-0804/propai/blob/main/src/lib/ai/duplicateDetector.ts): `src/lib/ai/duplicateDetector.ts`
- [Floor Plan API](https://github.com/rakesh-0804/propai/blob/main/src/app/api/ai/floor-plan/route.ts): `src/app/api/ai/floor-plan/route.ts`
- [Floor Plan Generation](https://github.com/rakesh-0804/propai/blob/main/src/lib/ai/floorPlanGenerator.ts): `src/lib/ai/floorPlanGenerator.ts`
- [3D Floor Plan Viewer](https://github.com/rakesh-0804/propai/blob/main/src/components/FloorPlan3DViewer.tsx): `src/components/FloorPlan3DViewer.tsx`

### Role Portals

- [Seller Portal](https://github.com/rakesh-0804/propai/blob/main/src/app/dashboard/seller/page.tsx): `src/app/dashboard/seller/page.tsx`
- [Admin Dashboard](https://github.com/rakesh-0804/propai/blob/main/src/app/dashboard/admin/page.tsx): `src/app/dashboard/admin/page.tsx`

### Visits & Access

- [Site Visits API](https://github.com/rakesh-0804/propai/blob/main/src/app/api/visits/route.ts): `src/app/api/visits/route.ts`
- [Smart Lock Gateway](https://github.com/rakesh-0804/propai/blob/main/src/lib/iot/smartLockGateway.ts): `src/lib/iot/smartLockGateway.ts`
- [360° Virtual Tours](https://github.com/rakesh-0804/propai/blob/main/src/components/VirtualTourViewer.tsx): `src/components/VirtualTourViewer.tsx`

### Identity & Data

- [Authentication](https://github.com/rakesh-0804/propai/blob/main/src/lib/auth.ts): `src/lib/auth.ts`
- [Application Database](https://github.com/rakesh-0804/propai/blob/main/src/lib/db.ts): `src/lib/db.ts`

### Other components

- **Buyer**
- **Seller**
- **Administrator**

## Connections

- Buyer → Property Browsing: browses listings
- Property Browsing → Property API: requests listings
- Property API → Application Database: reads and writes (evidence: `src/app/api/properties/route.ts`)
- Property API → Match Scoring: scores matches (evidence: `src/app/api/properties/route.ts`)
- Property API → Price Estimation: estimates prices (evidence: `src/app/api/properties/route.ts`)
- Buyer → NLP Search: searches naturally
- NLP Search → Semantic Search API: submits query
- Buyer → Property Detail: views listing
- Buyer → Property Comparison: compares homes
- Property Comparison → Comparison Metrics: computes metrics (evidence: `src/components/CompareMatrix.tsx`)
- Buyer → Investment Calculator: evaluates investment
- Investment Calculator → Underwriting API: requests analysis
- Underwriting API → Financial Underwriting: generates report (evidence: `src/app/api/ai/underwriting/route.ts`)
- Financial Underwriting → Application Database: reads property; stores report (evidence: `src/lib/ai/underwritingService.ts`)
- Buyer → Saved Properties: saves properties
- Saved Properties → Application Database: reads and updates (evidence: `src/app/api/wishlist/route.ts`)
- Buyer → Enquiries: contacts seller
- Enquiries → Application Database: stores enquiry; notifies (evidence: `src/app/api/enquiries/route.ts`)
- Seller → Seller Portal: manages listings
- Administrator → Admin Dashboard: reviews marketplace
- Admin Dashboard → Listing Fraud Detection: checks listings
- Buyer → Floor Plan API: requests floor plan
- Floor Plan API → Floor Plan Generation: generates layout (evidence: `src/app/api/ai/floor-plan/route.ts`)
- 3D Floor Plan Viewer → Floor Plan Generation: renders generated plans
- Buyer → Site Visits API: schedules tour
- Site Visits API → Application Database: stores visit (evidence: `src/app/api/visits/route.ts`)
- Site Visits API → Smart Lock Gateway: generates access PIN (evidence: `src/app/api/visits/route.ts`)
- Buyer → 360° Virtual Tours: views panorama
- Property Detail → 360° Virtual Tours: presents property tour
- Authentication → Application Database: loads user (evidence: `src/lib/auth.ts`)
- Property API → Authentication: checks current user (evidence: `src/app/api/properties/route.ts`)
- Site Visits API → Authentication: checks current user (evidence: `src/app/api/visits/route.ts`)
- Smart Lock Gateway → Application Database: updates access records (evidence: `src/lib/iot/smartLockGateway.ts`)
