# mayurh2007/zittet-ai-lead-recovery-engine-backend- architecture

> Architecture diagram of the GitHub repository mayurh2007/zittet-ai-lead-recovery-engine-backend-, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-07). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/mayurh2007/zittet-ai-lead-recovery-engine-backend-
- Repository: https://github.com/mayurh2007/zittet-ai-lead-recovery-engine-backend-

## Overview

Zizzet is a multi-tenant backend API for lead recovery, not a CRM UI. A tenant submits a lead and conversation for analysis; the service invokes an LLM, validates structured output, applies opt-out and scoring rules, and persists the result. Follow-up retrieval and idempotent webhook intake are separate product paths, with webhooks processed in the background. The graph follows the README’s architecture and capabilities; most implementation files are not present in the supplied tree or excerpts, so their paths are left null and edges rely on documented relationships.

Main entry points: [`main.py`](https://github.com/mayurh2007/zittet-ai-lead-recovery-engine-backend-/blob/main/main.py) (FastAPI App)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["HTTP API"]
  node_app["FastAPI App<br/>[main.py]"]
  node_lead_routes["Lead Routes"]
  node_webhook_routes["Webhook Route"]
  node_health["Health Route"]
end

subgraph group_domain["Lead Services"]
  node_lead_service["Lead Service"]
  node_followup_service["Follow-up Service"]
end

subgraph group_analysis["Analysis Engine"]
  node_analysis_service["Analysis Service"]
  node_llm_provider["LLM Provider"]
  node_output_validation["Output Validation"]
  node_business_rules["Business Rules"]
end

subgraph group_storage["Persistence"]
  node_lead_repository["Lead Repository"]
  node_analysis_repository["Analysis Repository"]
  node_webhook_repository["Webhook Repository"]
  node_postgres[("PostgreSQL")]
end

subgraph group_async["Webhook Processing"]
  node_webhook_service["Webhook Service"]
  node_background_worker["Background Worker"]
end

node_client(("Tenant Client"))

node_client -->|"sends requests"| node_app
node_app -->|"registers routes"| node_lead_routes
node_app -->|"registers routes"| node_webhook_routes
node_app -->|"registers route"| node_health
node_lead_routes -->|"delegates analysis"| node_lead_service
node_lead_routes -->|"requests follow-up"| node_followup_service
node_lead_service -->|"accesses lead data"| node_lead_repository
node_lead_service -->|"orchestrates analysis"| node_analysis_service
node_analysis_service -.->|"loads lead context"| node_lead_repository
node_analysis_service -->|"requests analysis"| node_llm_provider
node_llm_provider -->|"returns structured output"| node_analysis_service
node_analysis_service -->|"validates output"| node_output_validation
node_analysis_service -->|"applies rules"| node_business_rules
node_analysis_service -->|"persists analysis"| node_analysis_repository
node_followup_service -->|"reads stored analysis"| node_analysis_repository
node_webhook_routes -->|"delegates intake"| node_webhook_service
node_webhook_service -->|"records events"| node_webhook_repository
node_webhook_service -->|"schedules processing"| node_background_worker
node_background_worker -.->|"processes lead"| node_lead_service
node_lead_repository -->|"reads and writes"| node_postgres
node_analysis_repository -->|"reads and writes"| node_postgres
node_webhook_repository -->|"reads and writes"| node_postgres

click node_app "https://github.com/mayurh2007/zittet-ai-lead-recovery-engine-backend-/blob/main/main.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_lead_routes,node_webhook_routes,node_health,node_client toneBlue
class node_lead_service,node_followup_service toneAmber
class node_analysis_service,node_llm_provider,node_output_validation,node_business_rules toneMint
class node_lead_repository,node_analysis_repository,node_webhook_repository,node_postgres toneRose
class node_webhook_service,node_background_worker toneIndigo
```

## Components

### HTTP API

- [FastAPI App](https://github.com/mayurh2007/zittet-ai-lead-recovery-engine-backend-/blob/main/main.py): `main.py`
- **Lead Routes**
- **Webhook Route**
- **Health Route**

### Lead Services

- **Lead Service**
- **Follow-up Service**

### Analysis Engine

- **Analysis Service**
- **LLM Provider**
- **Output Validation**
- **Business Rules**

### Persistence

- **Lead Repository**
- **Analysis Repository**
- **Webhook Repository**
- **PostgreSQL**

### Webhook Processing

- **Webhook Service**
- **Background Worker**

### Other components

- **Tenant Client**

## Connections

- Tenant Client → FastAPI App: sends requests (evidence: `README.md`)
- FastAPI App → Lead Routes: registers routes (evidence: `main.py`)
- FastAPI App → Webhook Route: registers routes (evidence: `main.py`)
- FastAPI App → Health Route: registers route (evidence: `main.py`)
- Lead Routes → Lead Service: delegates analysis (evidence: `README.md`)
- Lead Routes → Follow-up Service: requests follow-up (evidence: `README.md`)
- Lead Service → Lead Repository: accesses lead data (evidence: `README.md`)
- Lead Service → Analysis Service: orchestrates analysis (evidence: `README.md`)
- Analysis Service → Lead Repository: loads lead context
- Analysis Service → LLM Provider: requests analysis (evidence: `README.md`)
- LLM Provider → Analysis Service: returns structured output (evidence: `README.md`)
- Analysis Service → Output Validation: validates output (evidence: `README.md`)
- Analysis Service → Business Rules: applies rules (evidence: `README.md`)
- Analysis Service → Analysis Repository: persists analysis (evidence: `README.md`)
- Follow-up Service → Analysis Repository: reads stored analysis (evidence: `README.md`)
- Webhook Route → Webhook Service: delegates intake (evidence: `README.md`)
- Webhook Service → Webhook Repository: records events (evidence: `README.md`)
- Webhook Service → Background Worker: schedules processing (evidence: `README.md`)
- Background Worker → Lead Service: processes lead
- Lead Repository → PostgreSQL: reads and writes (evidence: `README.md`)
- Analysis Repository → PostgreSQL: reads and writes (evidence: `README.md`)
- Webhook Repository → PostgreSQL: reads and writes (evidence: `README.md`)
