# arumuga-raja-p/real_estate_crm architecture

> Architecture diagram of the GitHub repository arumuga-raja-p/real_estate_crm, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/arumuga-raja-p/real_estate_crm
- Repository: https://github.com/arumuga-raja-p/real_estate_crm

## Overview

EstateFlow is a Next.js real-estate CRM for sales teams. Users review dashboard metrics, manage leads across a seven-stage pipeline, browse project/building/unit inventory, and create bookings; the booking workflow uses the CRM service and is documented as protected against concurrent double-booking in Supabase. The graph preserves the major lead, inventory, booking, profile, and dashboard capabilities. Source excerpts show the service’s Supabase client and selected operations, but not the full persistence or authorization implementation; database behavior is therefore represented as documented external capability.

Main entry points: [`src/lib/crm-service.ts`](https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/lib/crm-service.ts) (CRM service), [`src/components/layout/DashboardShell.tsx`](https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/components/layout/DashboardShell.tsx) (Dashboard shell), [`src/app/leads/page.tsx`](https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/app/leads/page.tsx) (Lead pipeline), [`src/components/bookings/BookingModal.tsx`](https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/components/bookings/BookingModal.tsx) (Booking form)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["CRM application"]
  node_dashboard["Dashboard<br/>[page.tsx]"]
  node_profile["User profile<br/>[page.tsx]"]
  node_health["Health endpoint<br/>[route.ts]"]
end

subgraph group_sales["Sales workflows"]
  node_leads_page["Lead pipeline<br/>[page.tsx]"]
  node_lead_detail["Lead record<br/>[page.tsx]"]
  node_lead_views["Lead views<br/>[LeadKanban.tsx]"]
  node_lead_table["Lead table<br/>[LeadTable.tsx]"]
  node_lead_modal["Lead editor<br/>[LeadModal.tsx]"]
  node_stage_badge["Stage badge<br/>[StageBadge.tsx]"]
  node_properties["Property inventory<br/>[page.tsx]"]
  node_concurrency_test["Concurrency demo"]
  node_bookings["Bookings<br/>[page.tsx]"]
  node_booking_modal["Booking form<br/>[BookingModal.tsx]"]
end

subgraph group_data["CRM data layer"]
  node_service["CRM service<br/>[crm-service.ts]"]
  node_crm_types["CRM domain types<br/>[crm.ts]"]
  node_mock_data[("Demo data<br/>[mock-data.ts]")]
  node_supabase_client["Supabase client<br/>[client.ts]"]
end

subgraph group_shell["Application shell"]
  node_dashboard_shell["Dashboard shell<br/>[DashboardShell.tsx]"]
  node_sidebar["Navigation sidebar<br/>[AppSidebar.tsx]"]
  node_header["Application header<br/>[AppHeader.tsx]"]
end

node_sales_user(("Sales team"))
node_supabase[("Supabase backend")]

node_sales_user -->|"opens"| node_dashboard
node_dashboard -->|"renders"| node_dashboard_shell
node_dashboard -->|"loads metrics"| node_service
node_dashboard -->|"opens"| node_lead_modal
node_dashboard -->|"opens"| node_booking_modal
node_dashboard -->|"opens"| node_concurrency_test
node_sales_user -->|"manages leads"| node_leads_page
node_leads_page -->|"renders"| node_dashboard_shell
node_leads_page -->|"loads and updates"| node_service
node_leads_page -->|"renders"| node_lead_views
node_leads_page -->|"renders"| node_lead_table
node_leads_page -->|"opens"| node_lead_modal
node_leads_page -->|"opens"| node_booking_modal
node_lead_table -->|"renders"| node_stage_badge
node_sales_user -->|"views lead"| node_lead_detail
node_lead_detail -->|"renders"| node_dashboard_shell
node_lead_detail -->|"loads lead"| node_service
node_lead_detail -->|"renders"| node_stage_badge
node_lead_detail -->|"opens"| node_booking_modal
node_sales_user -->|"browses inventory"| node_properties
node_properties -->|"renders"| node_dashboard_shell
node_properties -->|"loads inventory"| node_service
node_properties -->|"opens"| node_booking_modal
node_properties -->|"opens"| node_concurrency_test
node_sales_user -->|"reviews bookings"| node_bookings
node_bookings -->|"renders"| node_dashboard_shell
node_bookings -->|"loads bookings"| node_service
node_bookings -->|"opens"| node_booking_modal
node_booking_modal -->|"submits booking"| node_service
node_booking_modal -->|"refreshes units"| node_service
node_concurrency_test -->|"tests parallel bookings"| node_service
node_sales_user -->|"manages profile"| node_profile
node_profile -->|"renders"| node_dashboard_shell
node_profile -->|"reads and updates"| node_service
node_service -->|"initializes"| node_supabase_client
node_supabase_client -->|"connects"| node_supabase
node_service -->|"falls back to"| node_mock_data
node_service -->|"uses domain types"| node_crm_types
node_service -->|"queries and writes CRM data"| node_supabase
node_dashboard_shell -->|"renders"| node_sidebar
node_dashboard_shell -->|"renders"| node_header
node_health -->|"checks connection"| node_supabase

click node_dashboard "https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/app/page.tsx"
click node_leads_page "https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/app/leads/page.tsx"
click node_lead_detail "https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/app/leads/%5Bid%5D/page.tsx"
click node_lead_views "https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/components/leads/LeadKanban.tsx"
click node_lead_table "https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/components/leads/LeadTable.tsx"
click node_lead_modal "https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/components/leads/LeadModal.tsx"
click node_stage_badge "https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/components/leads/StageBadge.tsx"
click node_properties "https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/app/properties/page.tsx"
click node_concurrency_test "https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/components/properties/ConcurrencyTestModal.tsx"
click node_bookings "https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/app/bookings/page.tsx"
click node_booking_modal "https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/components/bookings/BookingModal.tsx"
click node_profile "https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/app/profile/page.tsx"
click node_service "https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/lib/crm-service.ts"
click node_crm_types "https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/lib/types/crm.ts"
click node_mock_data "https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/lib/mock-data.ts"
click node_supabase_client "https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/lib/supabase/client.ts"
click node_dashboard_shell "https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/components/layout/DashboardShell.tsx"
click node_sidebar "https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/components/layout/AppSidebar.tsx"
click node_header "https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/components/layout/AppHeader.tsx"
click node_health "https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/app/api/health/route.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_profile,node_health toneBlue
class node_leads_page,node_lead_detail,node_lead_views,node_lead_table,node_lead_modal,node_stage_badge,node_properties,node_concurrency_test,node_bookings,node_booking_modal,node_supabase toneAmber
class node_service,node_crm_types,node_mock_data,node_supabase_client toneMint
class node_dashboard_shell,node_sidebar,node_header toneRose
class node_sales_user toneIndigo
```

## Components

### CRM application

- [Dashboard](https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/app/page.tsx): `src/app/page.tsx`
- [User profile](https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/app/profile/page.tsx): `src/app/profile/page.tsx`
- [Health endpoint](https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/app/api/health/route.ts): `src/app/api/health/route.ts`

### Sales workflows

- [Lead pipeline](https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/app/leads/page.tsx): `src/app/leads/page.tsx`
- [Lead record](https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/app/leads/%5Bid%5D/page.tsx): `src/app/leads/[id]/page.tsx`
- [Lead views](https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/components/leads/LeadKanban.tsx): `src/components/leads/LeadKanban.tsx`
- [Lead table](https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/components/leads/LeadTable.tsx): `src/components/leads/LeadTable.tsx`
- [Lead editor](https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/components/leads/LeadModal.tsx): `src/components/leads/LeadModal.tsx`
- [Stage badge](https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/components/leads/StageBadge.tsx): `src/components/leads/StageBadge.tsx`
- [Property inventory](https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/app/properties/page.tsx): `src/app/properties/page.tsx`
- [Concurrency demo](https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/components/properties/ConcurrencyTestModal.tsx): `src/components/properties/ConcurrencyTestModal.tsx`
- [Bookings](https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/app/bookings/page.tsx): `src/app/bookings/page.tsx`
- [Booking form](https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/components/bookings/BookingModal.tsx): `src/components/bookings/BookingModal.tsx`

### CRM data layer

- [CRM service](https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/lib/crm-service.ts): `src/lib/crm-service.ts`
- [CRM domain types](https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/lib/types/crm.ts): `src/lib/types/crm.ts`
- [Demo data](https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/lib/mock-data.ts): `src/lib/mock-data.ts`
- [Supabase client](https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/lib/supabase/client.ts): `src/lib/supabase/client.ts`

### Application shell

- [Dashboard shell](https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/components/layout/DashboardShell.tsx): `src/components/layout/DashboardShell.tsx`
- [Navigation sidebar](https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/components/layout/AppSidebar.tsx): `src/components/layout/AppSidebar.tsx`
- [Application header](https://github.com/arumuga-raja-p/real_estate_crm/blob/main/src/components/layout/AppHeader.tsx): `src/components/layout/AppHeader.tsx`

### Other components

- **Sales team**
- **Supabase backend**

## Connections

- Sales team → Dashboard: opens (evidence: `README.md`)
- Dashboard → Dashboard shell: renders (evidence: `src/app/page.tsx`)
- Dashboard → CRM service: loads metrics (evidence: `src/app/page.tsx`)
- Dashboard → Lead editor: opens (evidence: `src/app/page.tsx`)
- Dashboard → Booking form: opens (evidence: `src/app/page.tsx`)
- Dashboard → Concurrency demo: opens (evidence: `src/app/page.tsx`)
- Sales team → Lead pipeline: manages leads (evidence: `README.md`)
- Lead pipeline → Dashboard shell: renders (evidence: `src/app/leads/page.tsx`)
- Lead pipeline → CRM service: loads and updates (evidence: `src/app/leads/page.tsx`)
- Lead pipeline → Lead views: renders (evidence: `src/app/leads/page.tsx`)
- Lead pipeline → Lead table: renders (evidence: `src/app/leads/page.tsx`)
- Lead pipeline → Lead editor: opens (evidence: `src/app/leads/page.tsx`)
- Lead pipeline → Booking form: opens (evidence: `src/app/leads/page.tsx`)
- Lead table → Stage badge: renders (evidence: `src/components/leads/LeadTable.tsx`)
- Sales team → Lead record: views lead (evidence: `README.md`)
- Lead record → Dashboard shell: renders (evidence: `src/app/leads/[id]/page.tsx`)
- Lead record → CRM service: loads lead (evidence: `src/app/leads/[id]/page.tsx`)
- Lead record → Stage badge: renders (evidence: `src/app/leads/[id]/page.tsx`)
- Lead record → Booking form: opens (evidence: `src/app/leads/[id]/page.tsx`)
- Sales team → Property inventory: browses inventory (evidence: `README.md`)
- Property inventory → Dashboard shell: renders (evidence: `src/app/properties/page.tsx`)
- Property inventory → CRM service: loads inventory (evidence: `src/app/properties/page.tsx`)
- Property inventory → Booking form: opens (evidence: `src/app/properties/page.tsx`)
- Property inventory → Concurrency demo: opens (evidence: `src/app/properties/page.tsx`)
- Sales team → Bookings: reviews bookings (evidence: `README.md`)
- Bookings → Dashboard shell: renders (evidence: `src/app/bookings/page.tsx`)
- Bookings → CRM service: loads bookings (evidence: `src/app/bookings/page.tsx`)
- Bookings → Booking form: opens (evidence: `src/app/bookings/page.tsx`)
- Booking form → CRM service: submits booking (evidence: `src/components/bookings/BookingModal.tsx`)
- Booking form → CRM service: refreshes units (evidence: `src/components/bookings/BookingModal.tsx`)
- Concurrency demo → CRM service: tests parallel bookings (evidence: `README.md`)
- Sales team → User profile: manages profile (evidence: `README.md`)
- User profile → Dashboard shell: renders (evidence: `src/app/profile/page.tsx`)
- User profile → CRM service: reads and updates (evidence: `src/app/profile/page.tsx`)
- CRM service → Supabase client: initializes (evidence: `src/lib/crm-service.ts`)
- Supabase client → Supabase backend: connects (evidence: `README.md`)
- CRM service → Demo data: falls back to (evidence: `README.md`)
- CRM service → CRM domain types: uses domain types (evidence: `src/lib/crm-service.ts`)
- CRM service → Supabase backend: queries and writes CRM data (evidence: `README.md`)
- Dashboard shell → Navigation sidebar: renders (evidence: `src/components/layout/DashboardShell.tsx`)
- Dashboard shell → Application header: renders (evidence: `src/components/layout/DashboardShell.tsx`)
- Health endpoint → Supabase backend: checks connection (evidence: `src/app/api/health/route.ts`)
