# manikantareddie/lead_management_system architecture

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

- Interactive diagram: https://gitdiagram.com/manikantareddie/lead_management_system
- Repository: https://github.com/manikantareddie/lead_management_system

## Overview

LMS is a role-based lead operations console backed by a FastAPI API and Supabase PostgreSQL, with an indexed fallback engine. Users sign in, navigate lead, task, pipeline, and reporting workflows, and privileged users can inspect investigations and data quality; lead details and updates are surfaced in the console. The README also documents lead scoring, routing, consent governance, dataset generation, and validation. Those backend connections are not shown in the sampled excerpts, so their internal wiring is left unasserted.

Main entry points: [`frontend/src/App.tsx`](https://github.com/manikantareddie/lead_management_system/blob/main/frontend/src/App.tsx) (App Shell), [`backend/main.py`](https://github.com/manikantareddie/lead_management_system/blob/main/backend/main.py) (FastAPI Service), [`backend/database.py`](https://github.com/manikantareddie/lead_management_system/blob/main/backend/database.py) (Database Access), [`src/validation/validator.py`](https://github.com/manikantareddie/lead_management_system/blob/main/src/validation/validator.py) (Dataset Validator)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_console["Operations Console"]
  node_app["App Shell<br/>[App.tsx]"]
  node_auth_context["Authentication State<br/>[AuthContext.tsx]"]
  node_data_context["Shared Data State<br/>[DataContext.tsx]"]
end

subgraph group_api["API and Persistence"]
  node_api_client["API Client<br/>[api.ts]"]
  node_backend_api["FastAPI Service<br/>[main.py]"]
  node_auth["API Authentication<br/>[auth.py]"]
  node_database_layer["Database Access<br/>[database.py]"]
  node_supabase[("Supabase PostgreSQL")]
end

subgraph group_lead_ops["Lead Operations"]
  node_lead_views["Lead Workbench<br/>[LeadsView.tsx]"]
  node_lead_detail["Lead Detail"]
  node_tasks["Task Management<br/>[TasksView.tsx]"]
  node_pipeline["Opportunity Pipeline<br/>[PipelineView.tsx]"]
  node_dashboard["Dashboard<br/>[DashboardView.tsx]"]
  node_reports["Reports<br/>[ReportsView.tsx]"]
  node_routing["Lead Routing<br/>[routing.py]"]
  node_consent["Consent Rules<br/>[consent.py]"]
  node_decisions["Lead Decisions<br/>[decisions.py]"]
  node_deduplication["Deduplication<br/>[deduplication.py]"]
  node_stages["Pipeline Stages<br/>[stages.py]"]
end

subgraph group_data_quality["Data Quality"]
  node_investigations["Investigations"]
  node_quality_view["Data Quality Console"]
  node_validator["Dataset Validator<br/>[validator.py]"]
  node_generator["Dataset Generator<br/>[generate.py]"]
end

node_user(("Console User"))

node_user -->|"uses"| node_app
node_app -->|"reads auth"| node_auth_context
node_app -->|"reads shared data"| node_data_context
node_app -->|"renders"| node_lead_views
node_app -->|"renders"| node_lead_detail
node_app -->|"renders"| node_tasks
node_app -->|"renders"| node_pipeline
node_app -->|"renders"| node_dashboard
node_app -->|"renders"| node_reports
node_app -->|"renders"| node_investigations
node_app -->|"renders"| node_quality_view
node_api_client -->|"calls REST API"| node_backend_api
node_backend_api -->|"queries"| node_database_layer
node_database_layer -->|"reads and writes"| node_supabase
node_backend_api -.->|"enforces bearer auth"| node_auth
node_backend_api -.->|"may apply routing"| node_routing
node_backend_api -.->|"may apply consent rules"| node_consent
node_backend_api -.->|"may apply decisions"| node_decisions
node_backend_api -.->|"may check duplicates"| node_deduplication
node_backend_api -.->|"may apply stages"| node_stages
node_backend_api -.->|"may run validation"| node_validator
node_generator -.->|"may feed validation"| node_validator

click node_app "https://github.com/manikantareddie/lead_management_system/blob/main/frontend/src/App.tsx"
click node_auth_context "https://github.com/manikantareddie/lead_management_system/blob/main/frontend/src/context/AuthContext.tsx"
click node_data_context "https://github.com/manikantareddie/lead_management_system/blob/main/frontend/src/context/DataContext.tsx"
click node_api_client "https://github.com/manikantareddie/lead_management_system/blob/main/frontend/src/services/api.ts"
click node_backend_api "https://github.com/manikantareddie/lead_management_system/blob/main/backend/main.py"
click node_auth "https://github.com/manikantareddie/lead_management_system/blob/main/backend/auth.py"
click node_database_layer "https://github.com/manikantareddie/lead_management_system/blob/main/backend/database.py"
click node_lead_views "https://github.com/manikantareddie/lead_management_system/blob/main/frontend/src/views/LeadsView.tsx"
click node_lead_detail "https://github.com/manikantareddie/lead_management_system/blob/main/frontend/src/views/LeadDetailDrawer.tsx"
click node_tasks "https://github.com/manikantareddie/lead_management_system/blob/main/frontend/src/views/TasksView.tsx"
click node_pipeline "https://github.com/manikantareddie/lead_management_system/blob/main/frontend/src/views/PipelineView.tsx"
click node_dashboard "https://github.com/manikantareddie/lead_management_system/blob/main/frontend/src/views/DashboardView.tsx"
click node_reports "https://github.com/manikantareddie/lead_management_system/blob/main/frontend/src/views/ReportsView.tsx"
click node_investigations "https://github.com/manikantareddie/lead_management_system/blob/main/frontend/src/views/InvestigationsView.tsx"
click node_quality_view "https://github.com/manikantareddie/lead_management_system/blob/main/frontend/src/views/DataQualityView.tsx"
click node_validator "https://github.com/manikantareddie/lead_management_system/blob/main/src/validation/validator.py"
click node_generator "https://github.com/manikantareddie/lead_management_system/blob/main/src/generator/generate.py"
click node_routing "https://github.com/manikantareddie/lead_management_system/blob/main/src/business/routing.py"
click node_consent "https://github.com/manikantareddie/lead_management_system/blob/main/src/business/consent.py"
click node_decisions "https://github.com/manikantareddie/lead_management_system/blob/main/src/business/decisions.py"
click node_deduplication "https://github.com/manikantareddie/lead_management_system/blob/main/src/business/deduplication.py"
click node_stages "https://github.com/manikantareddie/lead_management_system/blob/main/src/business/stages.py"

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_app,node_auth_context,node_data_context,node_user toneBlue
class node_api_client,node_backend_api,node_auth,node_database_layer,node_supabase toneAmber
class node_lead_views,node_lead_detail,node_tasks,node_pipeline,node_dashboard,node_reports,node_routing,node_consent,node_decisions,node_deduplication,node_stages toneMint
class node_investigations,node_quality_view,node_validator,node_generator toneRose
```

## Components

### Operations Console

- [App Shell](https://github.com/manikantareddie/lead_management_system/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Authentication State](https://github.com/manikantareddie/lead_management_system/blob/main/frontend/src/context/AuthContext.tsx): `frontend/src/context/AuthContext.tsx`
- [Shared Data State](https://github.com/manikantareddie/lead_management_system/blob/main/frontend/src/context/DataContext.tsx): `frontend/src/context/DataContext.tsx`

### API and Persistence

- [API Client](https://github.com/manikantareddie/lead_management_system/blob/main/frontend/src/services/api.ts): `frontend/src/services/api.ts`
- [FastAPI Service](https://github.com/manikantareddie/lead_management_system/blob/main/backend/main.py): `backend/main.py`
- [API Authentication](https://github.com/manikantareddie/lead_management_system/blob/main/backend/auth.py): `backend/auth.py`
- [Database Access](https://github.com/manikantareddie/lead_management_system/blob/main/backend/database.py): `backend/database.py`
- **Supabase PostgreSQL**

### Lead Operations

- [Lead Workbench](https://github.com/manikantareddie/lead_management_system/blob/main/frontend/src/views/LeadsView.tsx): `frontend/src/views/LeadsView.tsx`
- [Lead Detail](https://github.com/manikantareddie/lead_management_system/blob/main/frontend/src/views/LeadDetailDrawer.tsx): `frontend/src/views/LeadDetailDrawer.tsx`
- [Task Management](https://github.com/manikantareddie/lead_management_system/blob/main/frontend/src/views/TasksView.tsx): `frontend/src/views/TasksView.tsx`
- [Opportunity Pipeline](https://github.com/manikantareddie/lead_management_system/blob/main/frontend/src/views/PipelineView.tsx): `frontend/src/views/PipelineView.tsx`
- [Dashboard](https://github.com/manikantareddie/lead_management_system/blob/main/frontend/src/views/DashboardView.tsx): `frontend/src/views/DashboardView.tsx`
- [Reports](https://github.com/manikantareddie/lead_management_system/blob/main/frontend/src/views/ReportsView.tsx): `frontend/src/views/ReportsView.tsx`
- [Lead Routing](https://github.com/manikantareddie/lead_management_system/blob/main/src/business/routing.py): `src/business/routing.py`
- [Consent Rules](https://github.com/manikantareddie/lead_management_system/blob/main/src/business/consent.py): `src/business/consent.py`
- [Lead Decisions](https://github.com/manikantareddie/lead_management_system/blob/main/src/business/decisions.py): `src/business/decisions.py`
- [Deduplication](https://github.com/manikantareddie/lead_management_system/blob/main/src/business/deduplication.py): `src/business/deduplication.py`
- [Pipeline Stages](https://github.com/manikantareddie/lead_management_system/blob/main/src/business/stages.py): `src/business/stages.py`

### Data Quality

- [Investigations](https://github.com/manikantareddie/lead_management_system/blob/main/frontend/src/views/InvestigationsView.tsx): `frontend/src/views/InvestigationsView.tsx`
- [Data Quality Console](https://github.com/manikantareddie/lead_management_system/blob/main/frontend/src/views/DataQualityView.tsx): `frontend/src/views/DataQualityView.tsx`
- [Dataset Validator](https://github.com/manikantareddie/lead_management_system/blob/main/src/validation/validator.py): `src/validation/validator.py`
- [Dataset Generator](https://github.com/manikantareddie/lead_management_system/blob/main/src/generator/generate.py): `src/generator/generate.py`

### Other components

- **Console User**

## Connections

- Console User → App Shell: uses (evidence: `README.md`)
- App Shell → Authentication State: reads auth (evidence: `frontend/src/App.tsx`)
- App Shell → Shared Data State: reads shared data (evidence: `frontend/src/App.tsx`)
- App Shell → Lead Workbench: renders (evidence: `frontend/src/App.tsx`)
- App Shell → Lead Detail: renders (evidence: `frontend/src/App.tsx`)
- App Shell → Task Management: renders (evidence: `frontend/src/App.tsx`)
- App Shell → Opportunity Pipeline: renders (evidence: `frontend/src/App.tsx`)
- App Shell → Dashboard: renders (evidence: `frontend/src/App.tsx`)
- App Shell → Reports: renders (evidence: `frontend/src/App.tsx`)
- App Shell → Investigations: renders (evidence: `frontend/src/App.tsx`)
- App Shell → Data Quality Console: renders (evidence: `frontend/src/App.tsx`)
- API Client → FastAPI Service: calls REST API (evidence: `README.md`)
- FastAPI Service → Database Access: queries (evidence: `README.md`)
- Database Access → Supabase PostgreSQL: reads and writes (evidence: `README.md`)
- FastAPI Service → API Authentication: enforces bearer auth
- FastAPI Service → Lead Routing: may apply routing
- FastAPI Service → Consent Rules: may apply consent rules
- FastAPI Service → Lead Decisions: may apply decisions
- FastAPI Service → Deduplication: may check duplicates
- FastAPI Service → Pipeline Stages: may apply stages
- FastAPI Service → Dataset Validator: may run validation
- Dataset Generator → Dataset Validator: may feed validation
