# pranshupujara/codecraft_proptech architecture

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

- Interactive diagram: https://gitdiagram.com/pranshupujara/codecraft_proptech
- Repository: https://github.com/pranshupujara/codecraft_proptech

## Overview

This is a rental-intelligence web application: renters browse and shortlist properties, compare their true costs, and use personalized recommendations and decision support to choose a home. Related workflows cover roommate compatibility, rental-agreement analysis, and a grounded AI copilot. The graph maps the dashboard entry points to their API capabilities and the sampled route-to-service calls; several page and subsystem implementations were not sampled, so their internal wiring is intentionally left unspecified.

Main entry points: [`lib/db.ts`](https://github.com/pranshupujara/codecraft_proptech/blob/main/lib/db.ts) (Application database), [`app/api/agreements/route.ts`](https://github.com/pranshupujara/codecraft_proptech/blob/main/app/api/agreements/route.ts) (Agreement extraction), [`app/api/decision-assistant/route.ts`](https://github.com/pranshupujara/codecraft_proptech/blob/main/app/api/decision-assistant/route.ts) (Decision synthesis), [`app/api/copilot/route.ts`](https://github.com/pranshupujara/codecraft_proptech/blob/main/app/api/copilot/route.ts) (Copilot conversation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Renter experience"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_discover["Discover properties<br/>[page.tsx]"]
  node_detail["Property detail<br/>[page.tsx]"]
  node_saved["Saved properties<br/>[page.tsx]"]
  node_compare_ui["Compare homes<br/>[page.tsx]"]
  node_recommend_ui["Recommendations<br/>[page.tsx]"]
  node_roommates_ui["Roommate matching<br/>[page.tsx]"]
  node_agreements_ui["Agreement review<br/>[page.tsx]"]
  node_decision_ui["Decision assistant<br/>[page.tsx]"]
  node_copilot_ui["Rental copilot<br/>[page.tsx]"]
end

subgraph group_property["Property decisions"]
  node_properties_api["Property search<br/>[route.ts]"]
  node_property_detail_api["Property lookup<br/>[route.ts]"]
  node_saved_api["Shortlist management<br/>[route.ts]"]
  node_compare_api["Cost comparison<br/>[route.ts]"]
  node_recommend_api["Property recommendations<br/>[route.ts]"]
  node_cost["Cost calculations<br/>[cost.ts]"]
end

subgraph group_assistance["AI assistance"]
  node_roommates_api["Compatibility analysis<br/>[route.ts]"]
  node_agreements_api["Agreement extraction<br/>[route.ts]"]
  node_agreement_detail["Agreement retrieval<br/>[route.ts]"]
  node_pdf["PDF text extraction<br/>[agreementPdf.ts]"]
  node_decision_api["Decision synthesis<br/>[route.ts]"]
  node_copilot_api["Copilot conversation<br/>[route.ts]"]
  node_copilot_context["User context<br/>[copilotContext.ts]"]
  node_ai_client["Structured AI client<br/>[client.ts]"]
end

subgraph group_platform["Application services"]
  node_preferences_api["Preference management<br/>[route.ts]"]
  node_auth["Authentication<br/>[auth-session.ts]"]
  node_db[("Application database<br/>[db.ts]")]
end

node_renter(("Renter"))

node_renter -->|"opens"| node_dashboard
node_renter -->|"browses"| node_discover
node_renter -->|"shortlists"| node_saved
node_renter -->|"compares"| node_compare_ui
node_renter -->|"requests"| node_recommend_ui
node_renter -->|"matches"| node_roommates_ui
node_renter -->|"reviews"| node_agreements_ui
node_renter -->|"seeks advice"| node_decision_ui
node_renter -->|"asks"| node_copilot_ui
node_discover -->|"searches"| node_properties_api
node_detail -->|"loads"| node_property_detail_api
node_saved -->|"manages"| node_saved_api
node_compare_ui -->|"compares"| node_compare_api
node_recommend_ui -->|"requests"| node_recommend_api
node_roommates_ui -->|"submits profiles"| node_roommates_api
node_agreements_ui -->|"uploads"| node_agreements_api
node_agreements_ui -->|"retrieves"| node_agreement_detail
node_decision_ui -->|"requests"| node_decision_api
node_copilot_ui -->|"sends query"| node_copilot_api
node_properties_api -->|"queries"| node_db
node_property_detail_api -->|"reads"| node_db
node_saved_api -->|"reads/writes"| node_db
node_compare_api -->|"loads properties"| node_db
node_compare_api -->|"calculates costs"| node_cost
node_compare_api -->|"requests analysis"| node_ai_client
node_recommend_api -->|"loads preferences and homes"| node_db
node_recommend_api -->|"calculates costs"| node_cost
node_roommates_api -->|"requests explanation"| node_ai_client
node_agreements_api -->|"identifies user"| node_auth
node_agreements_api -->|"extracts text"| node_pdf
node_agreements_api -->|"extracts and flags"| node_ai_client
node_agreements_api -->|"stores agreement"| node_db
node_agreement_detail -->|"identifies user"| node_auth
node_agreement_detail -->|"loads agreement"| node_db
node_decision_api -->|"identifies user"| node_auth
node_decision_api -->|"loads user and saved homes"| node_db
node_decision_api -->|"calculates costs"| node_cost
node_decision_api -->|"requests synthesis"| node_ai_client
node_copilot_api -->|"identifies user"| node_auth
node_copilot_api -->|"loads context"| node_copilot_context
node_copilot_context -->|"reads user data"| node_db
node_copilot_api -->|"generates answer"| node_ai_client
node_copilot_api -->|"stores chat"| node_db
node_preferences_api -->|"reads/writes preferences"| node_db

click node_dashboard "https://github.com/pranshupujara/codecraft_proptech/blob/main/app/(dashboard)/dashboard/page.tsx"
click node_discover "https://github.com/pranshupujara/codecraft_proptech/blob/main/app/(dashboard)/discover/page.tsx"
click node_detail "https://github.com/pranshupujara/codecraft_proptech/blob/main/app/(dashboard)/properties/%5Bid%5D/page.tsx"
click node_saved "https://github.com/pranshupujara/codecraft_proptech/blob/main/app/(dashboard)/saved/page.tsx"
click node_compare_ui "https://github.com/pranshupujara/codecraft_proptech/blob/main/app/(dashboard)/compare/page.tsx"
click node_recommend_ui "https://github.com/pranshupujara/codecraft_proptech/blob/main/app/(dashboard)/recommendations/page.tsx"
click node_properties_api "https://github.com/pranshupujara/codecraft_proptech/blob/main/app/api/properties/route.ts"
click node_property_detail_api "https://github.com/pranshupujara/codecraft_proptech/blob/main/app/api/properties/%5Bid%5D/route.ts"
click node_saved_api "https://github.com/pranshupujara/codecraft_proptech/blob/main/app/api/saved/route.ts"
click node_compare_api "https://github.com/pranshupujara/codecraft_proptech/blob/main/app/api/compare/route.ts"
click node_recommend_api "https://github.com/pranshupujara/codecraft_proptech/blob/main/app/api/recommendations/route.ts"
click node_cost "https://github.com/pranshupujara/codecraft_proptech/blob/main/lib/cost.ts"
click node_roommates_ui "https://github.com/pranshupujara/codecraft_proptech/blob/main/app/(dashboard)/roommates/page.tsx"
click node_roommates_api "https://github.com/pranshupujara/codecraft_proptech/blob/main/app/api/roommates/compatibility/route.ts"
click node_agreements_ui "https://github.com/pranshupujara/codecraft_proptech/blob/main/app/(dashboard)/agreements/page.tsx"
click node_agreements_api "https://github.com/pranshupujara/codecraft_proptech/blob/main/app/api/agreements/route.ts"
click node_agreement_detail "https://github.com/pranshupujara/codecraft_proptech/blob/main/app/api/agreements/%5Bid%5D/route.ts"
click node_pdf "https://github.com/pranshupujara/codecraft_proptech/blob/main/lib/agreementPdf.ts"
click node_decision_ui "https://github.com/pranshupujara/codecraft_proptech/blob/main/app/(dashboard)/assistant/page.tsx"
click node_decision_api "https://github.com/pranshupujara/codecraft_proptech/blob/main/app/api/decision-assistant/route.ts"
click node_copilot_ui "https://github.com/pranshupujara/codecraft_proptech/blob/main/app/(dashboard)/copilot/page.tsx"
click node_copilot_api "https://github.com/pranshupujara/codecraft_proptech/blob/main/app/api/copilot/route.ts"
click node_copilot_context "https://github.com/pranshupujara/codecraft_proptech/blob/main/lib/ai/copilotContext.ts"
click node_ai_client "https://github.com/pranshupujara/codecraft_proptech/blob/main/lib/ai/client.ts"
click node_preferences_api "https://github.com/pranshupujara/codecraft_proptech/blob/main/app/api/user/preferences/route.ts"
click node_auth "https://github.com/pranshupujara/codecraft_proptech/blob/main/lib/auth-session.ts"
click node_db "https://github.com/pranshupujara/codecraft_proptech/blob/main/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_dashboard,node_discover,node_detail,node_saved,node_compare_ui,node_recommend_ui,node_roommates_ui,node_agreements_ui,node_decision_ui,node_copilot_ui toneBlue
class node_properties_api,node_property_detail_api,node_saved_api,node_compare_api,node_recommend_api,node_cost toneAmber
class node_roommates_api,node_agreements_api,node_agreement_detail,node_pdf,node_decision_api,node_copilot_api,node_copilot_context,node_ai_client toneMint
class node_preferences_api,node_auth,node_db toneRose
class node_renter toneIndigo
```

## Components

### Renter experience

- [Dashboard](https://github.com/pranshupujara/codecraft_proptech/blob/main/app/(dashboard)/dashboard/page.tsx): `app/(dashboard)/dashboard/page.tsx`
- [Discover properties](https://github.com/pranshupujara/codecraft_proptech/blob/main/app/(dashboard)/discover/page.tsx): `app/(dashboard)/discover/page.tsx`
- [Property detail](https://github.com/pranshupujara/codecraft_proptech/blob/main/app/(dashboard)/properties/%5Bid%5D/page.tsx): `app/(dashboard)/properties/[id]/page.tsx`
- [Saved properties](https://github.com/pranshupujara/codecraft_proptech/blob/main/app/(dashboard)/saved/page.tsx): `app/(dashboard)/saved/page.tsx`
- [Compare homes](https://github.com/pranshupujara/codecraft_proptech/blob/main/app/(dashboard)/compare/page.tsx): `app/(dashboard)/compare/page.tsx`
- [Recommendations](https://github.com/pranshupujara/codecraft_proptech/blob/main/app/(dashboard)/recommendations/page.tsx): `app/(dashboard)/recommendations/page.tsx`
- [Roommate matching](https://github.com/pranshupujara/codecraft_proptech/blob/main/app/(dashboard)/roommates/page.tsx): `app/(dashboard)/roommates/page.tsx`
- [Agreement review](https://github.com/pranshupujara/codecraft_proptech/blob/main/app/(dashboard)/agreements/page.tsx): `app/(dashboard)/agreements/page.tsx`
- [Decision assistant](https://github.com/pranshupujara/codecraft_proptech/blob/main/app/(dashboard)/assistant/page.tsx): `app/(dashboard)/assistant/page.tsx`
- [Rental copilot](https://github.com/pranshupujara/codecraft_proptech/blob/main/app/(dashboard)/copilot/page.tsx): `app/(dashboard)/copilot/page.tsx`

### Property decisions

- [Property search](https://github.com/pranshupujara/codecraft_proptech/blob/main/app/api/properties/route.ts): `app/api/properties/route.ts`
- [Property lookup](https://github.com/pranshupujara/codecraft_proptech/blob/main/app/api/properties/%5Bid%5D/route.ts): `app/api/properties/[id]/route.ts`
- [Shortlist management](https://github.com/pranshupujara/codecraft_proptech/blob/main/app/api/saved/route.ts): `app/api/saved/route.ts`
- [Cost comparison](https://github.com/pranshupujara/codecraft_proptech/blob/main/app/api/compare/route.ts): `app/api/compare/route.ts`
- [Property recommendations](https://github.com/pranshupujara/codecraft_proptech/blob/main/app/api/recommendations/route.ts): `app/api/recommendations/route.ts`
- [Cost calculations](https://github.com/pranshupujara/codecraft_proptech/blob/main/lib/cost.ts): `lib/cost.ts`

### AI assistance

- [Compatibility analysis](https://github.com/pranshupujara/codecraft_proptech/blob/main/app/api/roommates/compatibility/route.ts): `app/api/roommates/compatibility/route.ts`
- [Agreement extraction](https://github.com/pranshupujara/codecraft_proptech/blob/main/app/api/agreements/route.ts): `app/api/agreements/route.ts`
- [Agreement retrieval](https://github.com/pranshupujara/codecraft_proptech/blob/main/app/api/agreements/%5Bid%5D/route.ts): `app/api/agreements/[id]/route.ts`
- [PDF text extraction](https://github.com/pranshupujara/codecraft_proptech/blob/main/lib/agreementPdf.ts): `lib/agreementPdf.ts`
- [Decision synthesis](https://github.com/pranshupujara/codecraft_proptech/blob/main/app/api/decision-assistant/route.ts): `app/api/decision-assistant/route.ts`
- [Copilot conversation](https://github.com/pranshupujara/codecraft_proptech/blob/main/app/api/copilot/route.ts): `app/api/copilot/route.ts`
- [User context](https://github.com/pranshupujara/codecraft_proptech/blob/main/lib/ai/copilotContext.ts): `lib/ai/copilotContext.ts`
- [Structured AI client](https://github.com/pranshupujara/codecraft_proptech/blob/main/lib/ai/client.ts): `lib/ai/client.ts`

### Application services

- [Preference management](https://github.com/pranshupujara/codecraft_proptech/blob/main/app/api/user/preferences/route.ts): `app/api/user/preferences/route.ts`
- [Authentication](https://github.com/pranshupujara/codecraft_proptech/blob/main/lib/auth-session.ts): `lib/auth-session.ts`
- [Application database](https://github.com/pranshupujara/codecraft_proptech/blob/main/lib/db.ts): `lib/db.ts`

### Other components

- **Renter**

## Connections

- Renter → Dashboard: opens
- Renter → Discover properties: browses
- Renter → Saved properties: shortlists
- Renter → Compare homes: compares
- Renter → Recommendations: requests
- Renter → Roommate matching: matches
- Renter → Agreement review: reviews
- Renter → Decision assistant: seeks advice
- Renter → Rental copilot: asks
- Discover properties → Property search: searches
- Property detail → Property lookup: loads
- Saved properties → Shortlist management: manages
- Compare homes → Cost comparison: compares
- Recommendations → Property recommendations: requests
- Roommate matching → Compatibility analysis: submits profiles
- Agreement review → Agreement extraction: uploads
- Agreement review → Agreement retrieval: retrieves
- Decision assistant → Decision synthesis: requests
- Rental copilot → Copilot conversation: sends query
- Property search → Application database: queries
- Property lookup → Application database: reads
- Shortlist management → Application database: reads/writes
- Cost comparison → Application database: loads properties
- Cost comparison → Cost calculations: calculates costs
- Cost comparison → Structured AI client: requests analysis
- Property recommendations → Application database: loads preferences and homes
- Property recommendations → Cost calculations: calculates costs
- Compatibility analysis → Structured AI client: requests explanation
- Agreement extraction → Authentication: identifies user
- Agreement extraction → PDF text extraction: extracts text
- Agreement extraction → Structured AI client: extracts and flags
- Agreement extraction → Application database: stores agreement
- Agreement retrieval → Authentication: identifies user
- Agreement retrieval → Application database: loads agreement
- Decision synthesis → Authentication: identifies user
- Decision synthesis → Application database: loads user and saved homes
- Decision synthesis → Cost calculations: calculates costs
- Decision synthesis → Structured AI client: requests synthesis
- Copilot conversation → Authentication: identifies user
- Copilot conversation → User context: loads context
- User context → Application database: reads user data
- Copilot conversation → Structured AI client: generates answer
- Copilot conversation → Application database: stores chat
- Preference management → Application database: reads/writes preferences
