# nihilkaarthikeyan-tech/estateflow architecture

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

- Interactive diagram: https://gitdiagram.com/nihilkaarthikeyan-tech/estateflow
- Repository: https://github.com/nihilkaarthikeyan-tech/estateflow

## Overview

EstateFlow AI is a multi-tenant real-estate operations platform. Agencies capture leads through public forms or a webhook; leads are analyzed, matched to available properties, and worked through a CRM pipeline with follow-ups and notifications. The dashboard also supports property and tenant operations, visits, and analytics; tenants have a maintenance portal. The graph preserves these documented capabilities and sampled internal layers. README statements support several product-level links; source excerpts show webhook processing, lead enrichment, matching, and analytics. Other unsampled routes are represented without inferred call chains.

Main entry points: [`src/lib/supabase/server.ts`](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/lib/supabase/server.ts) (Supabase services), [`src/app/api/lead-webhook/route.ts`](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/api/lead-webhook/route.ts) (Lead intake), [`src/components/dashboard/DashboardShell.tsx`](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/components/dashboard/DashboardShell.tsx) (Agency dashboard), [`src/app/api/generate-insights/route.ts`](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/api/generate-insights/route.ts) (AI business insights)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Agency experience"]
  node_dashboard["Agency dashboard<br/>[DashboardShell.tsx]"]
  node_analytics["Lead analytics<br/>[page.tsx]"]
  node_insights["AI business insights<br/>[route.ts]"]
end

subgraph group_leadops["Lead operations"]
  node_crm["Lead pipeline<br/>[KanbanBoard.tsx]"]
  node_leadform["Lead entry form<br/>[LeadFormModal.tsx]"]
  node_leadhooks["Lead data access<br/>[useLeads.ts]"]
  node_webhook["Lead intake<br/>[route.ts]"]
  node_enrich["Lead enrichment<br/>[route.ts]"]
  node_analysis["AI lead analysis<br/>[route.ts]"]
  node_matching["Property matching<br/>[route.ts]"]
  node_followups["AI follow-ups<br/>[route.ts]"]
  node_notifications["Notifications<br/>[route.ts]"]
end

subgraph group_property["Property operations"]
  node_properties["Property management"]
  node_visits["Visit booking<br/>[route.ts]"]
  node_publiclistings["Public listings<br/>[route.ts]"]
end

subgraph group_tenant["Tenant services"]
  node_tenantportal["Tenant portal<br/>[page.tsx]"]
  node_maintenance["Maintenance requests<br/>[route.ts]"]
  node_leaseops["Leases and tenants<br/>[LeaseFormModal.tsx]"]
end

subgraph group_platform["Platform services"]
  node_automation["Scheduled workflows"]
  node_supabase[("Supabase services<br/>[server.ts]")]
  node_email["Email delivery<br/>[email.ts]"]
  node_guardrails["Input safeguards<br/>[sanitize.ts]"]
  node_limiter["Rate limiting<br/>[rate-limit.ts]"]
  node_auth["Authentication<br/>[provider.tsx]"]
end

node_agency(("Agency staff"))
node_prospects(("Prospective clients"))
node_openai["OpenAI"]
node_public(("Public website visitors"))

node_agency -->|"uses"| node_dashboard
node_dashboard -->|"manages"| node_crm
node_dashboard -->|"manages"| node_properties
node_dashboard -->|"views"| node_analytics
node_prospects -->|"submits lead"| node_webhook
node_public -->|"submits inquiry"| node_leadform
node_leadform -->|"adds lead"| node_leadhooks
node_leadhooks -->|"reads and writes"| node_supabase
node_leadhooks -->|"requests enrichment"| node_enrich
node_webhook -->|"analyzes message"| node_openai
node_webhook -->|"stores lead"| node_supabase
node_webhook -->|"sends alerts"| node_email
node_webhook -->|"sanitizes input"| node_guardrails
node_webhook -->|"limits requests"| node_limiter
node_enrich -->|"updates lead"| node_supabase
node_analysis -->|"extracts intent"| node_openai
node_analysis -->|"updates lead"| node_supabase
node_matching -->|"reads lead and listings"| node_supabase
node_crm -->|"drafts messages"| node_followups
node_crm -->|"requests matches"| node_matching
node_notifications -->|"reads and updates"| node_supabase
node_analytics -->|"requests insights"| node_insights
node_insights -->|"reads lead data"| node_supabase
node_insights -->|"generates insights"| node_openai
node_public -->|"browses listings"| node_publiclistings
node_public -->|"books visit"| node_visits
node_visits -.->|"stores booking"| node_supabase
node_tenantportal -->|"submits request"| node_maintenance
node_maintenance -->|"stores ticket"| node_supabase
node_leaseops -.->|"manages records"| node_supabase
node_automation -->|"sends lead intake"| node_webhook
node_auth -.->|"authenticates users"| node_supabase

click node_dashboard "https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/components/dashboard/DashboardShell.tsx"
click node_crm "https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/components/leads/KanbanBoard.tsx"
click node_leadform "https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/components/leads/LeadFormModal.tsx"
click node_leadhooks "https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/lib/hooks/useLeads.ts"
click node_webhook "https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/api/lead-webhook/route.ts"
click node_enrich "https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/api/leads/enrich/route.ts"
click node_analysis "https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/api/analyze-lead/route.ts"
click node_matching "https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/api/recommend-properties/route.ts"
click node_followups "https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/api/generate-followup/route.ts"
click node_notifications "https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/api/notifications/route.ts"
click node_properties "https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/components/properties/PropertyFormModal.tsx"
click node_visits "https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/api/public/book-visit/route.ts"
click node_publiclistings "https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/api/public/properties/route.ts"
click node_analytics "https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/dashboard/analytics/page.tsx"
click node_insights "https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/api/generate-insights/route.ts"
click node_tenantportal "https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/tenant-portal/page.tsx"
click node_maintenance "https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/api/tenant-portal/maintenance/route.ts"
click node_leaseops "https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/components/tenants/LeaseFormModal.tsx"
click node_automation "https://github.com/nihilkaarthikeyan-tech/estateflow/tree/main/src/app/api/n8n"
click node_supabase "https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/lib/supabase/server.ts"
click node_email "https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/lib/email.ts"
click node_guardrails "https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/lib/sanitize.ts"
click node_limiter "https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/lib/rate-limit.ts"
click node_auth "https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/lib/auth/provider.tsx"

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_analytics,node_insights,node_prospects toneBlue
class node_crm,node_leadform,node_leadhooks,node_webhook,node_enrich,node_analysis,node_matching,node_followups,node_notifications toneAmber
class node_properties,node_visits,node_publiclistings toneMint
class node_tenantportal,node_maintenance,node_leaseops toneRose
class node_automation,node_supabase,node_email,node_guardrails,node_limiter,node_auth,node_agency,node_openai,node_public toneIndigo
```

## Components

### Agency experience

- [Agency dashboard](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/components/dashboard/DashboardShell.tsx): `src/components/dashboard/DashboardShell.tsx`
- [Lead analytics](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/dashboard/analytics/page.tsx): `src/app/dashboard/analytics/page.tsx`
- [AI business insights](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/api/generate-insights/route.ts): `src/app/api/generate-insights/route.ts`

### Lead operations

- [Lead pipeline](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/components/leads/KanbanBoard.tsx): `src/components/leads/KanbanBoard.tsx`
- [Lead entry form](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/components/leads/LeadFormModal.tsx): `src/components/leads/LeadFormModal.tsx`
- [Lead data access](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/lib/hooks/useLeads.ts): `src/lib/hooks/useLeads.ts`
- [Lead intake](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/api/lead-webhook/route.ts): `src/app/api/lead-webhook/route.ts`
- [Lead enrichment](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/api/leads/enrich/route.ts): `src/app/api/leads/enrich/route.ts`
- [AI lead analysis](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/api/analyze-lead/route.ts): `src/app/api/analyze-lead/route.ts`
- [Property matching](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/api/recommend-properties/route.ts): `src/app/api/recommend-properties/route.ts`
- [AI follow-ups](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/api/generate-followup/route.ts): `src/app/api/generate-followup/route.ts`
- [Notifications](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/api/notifications/route.ts): `src/app/api/notifications/route.ts`

### Property operations

- [Property management](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/components/properties/PropertyFormModal.tsx): `src/components/properties/PropertyFormModal.tsx`
- [Visit booking](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/api/public/book-visit/route.ts): `src/app/api/public/book-visit/route.ts`
- [Public listings](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/api/public/properties/route.ts): `src/app/api/public/properties/route.ts`

### Tenant services

- [Tenant portal](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/tenant-portal/page.tsx): `src/app/tenant-portal/page.tsx`
- [Maintenance requests](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/app/api/tenant-portal/maintenance/route.ts): `src/app/api/tenant-portal/maintenance/route.ts`
- [Leases and tenants](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/components/tenants/LeaseFormModal.tsx): `src/components/tenants/LeaseFormModal.tsx`

### Platform services

- [Scheduled workflows](https://github.com/nihilkaarthikeyan-tech/estateflow/tree/main/src/app/api/n8n): `src/app/api/n8n`
- [Supabase services](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/lib/supabase/server.ts): `src/lib/supabase/server.ts`
- [Email delivery](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/lib/email.ts): `src/lib/email.ts`
- [Input safeguards](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/lib/sanitize.ts): `src/lib/sanitize.ts`
- [Rate limiting](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/lib/rate-limit.ts): `src/lib/rate-limit.ts`
- [Authentication](https://github.com/nihilkaarthikeyan-tech/estateflow/blob/main/src/lib/auth/provider.tsx): `src/lib/auth/provider.tsx`

### Other components

- **Agency staff**
- **Prospective clients**
- **OpenAI**
- **Public website visitors**

## Connections

- Agency staff → Agency dashboard: uses
- Agency dashboard → Lead pipeline: manages
- Agency dashboard → Property management: manages
- Agency dashboard → Lead analytics: views
- Prospective clients → Lead intake: submits lead (evidence: `src/app/api/lead-webhook/route.ts`)
- Public website visitors → Lead entry form: submits inquiry
- Lead entry form → Lead data access: adds lead (evidence: `src/lib/hooks/useLeads.ts`)
- Lead data access → Supabase services: reads and writes (evidence: `src/lib/hooks/useLeads.ts`)
- Lead data access → Lead enrichment: requests enrichment (evidence: `src/lib/hooks/useLeads.ts`)
- Lead intake → OpenAI: analyzes message (evidence: `src/app/api/lead-webhook/route.ts`)
- Lead intake → Supabase services: stores lead (evidence: `src/app/api/lead-webhook/route.ts`)
- Lead intake → Email delivery: sends alerts (evidence: `src/app/api/lead-webhook/route.ts`)
- Lead intake → Input safeguards: sanitizes input (evidence: `src/app/api/lead-webhook/route.ts`)
- Lead intake → Rate limiting: limits requests (evidence: `src/app/api/lead-webhook/route.ts`)
- Lead enrichment → Supabase services: updates lead (evidence: `src/app/api/leads/enrich/route.ts`)
- AI lead analysis → OpenAI: extracts intent (evidence: `src/app/api/analyze-lead/route.ts`)
- AI lead analysis → Supabase services: updates lead (evidence: `src/app/api/analyze-lead/route.ts`)
- Property matching → Supabase services: reads lead and listings (evidence: `src/app/api/recommend-properties/route.ts`)
- Lead pipeline → AI follow-ups: drafts messages
- Lead pipeline → Property matching: requests matches
- Notifications → Supabase services: reads and updates (evidence: `src/app/api/notifications/route.ts`)
- Lead analytics → AI business insights: requests insights
- AI business insights → Supabase services: reads lead data (evidence: `src/app/api/generate-insights/route.ts`)
- AI business insights → OpenAI: generates insights (evidence: `src/app/api/generate-insights/route.ts`)
- Public website visitors → Public listings: browses listings
- Public website visitors → Visit booking: books visit
- Visit booking → Supabase services: stores booking
- Tenant portal → Maintenance requests: submits request
- Maintenance requests → Supabase services: stores ticket (evidence: `src/app/api/tenant-portal/maintenance/route.ts`)
- Leases and tenants → Supabase services: manages records
- Scheduled workflows → Lead intake: sends lead intake
- Authentication → Supabase services: authenticates users
