# sakshi07102005/li-crm architecture

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

- Interactive diagram: https://gitdiagram.com/sakshi07102005/li-crm
- Repository: https://github.com/sakshi07102005/li-crm

## Overview

LI CRM is a role-governed, multi-channel CRM for acquiring leads, managing sales pipelines and customer relationships, and tracking sales activity. The principal workflow is a user working in the web or mobile client, submitting lead operations to the REST API, and receiving results from its business services and PostgreSQL. The README also identifies reporting, imports, tasks, notifications, audit, and RBAC as product capabilities. Mobile implementation sources and several backend feature implementations were not sampled, so some subsystem links are left unverified.

Main entry points: [`backend/src/services/lead.service.ts`](https://github.com/sakshi07102005/li-crm/blob/main/backend/src/services/lead.service.ts) (Lead management), [`backend/src/routes/lead.routes.ts`](https://github.com/sakshi07102005/li-crm/blob/main/backend/src/routes/lead.routes.ts) (Lead routes), [`backend/src/controllers/lead.controller.ts`](https://github.com/sakshi07102005/li-crm/blob/main/backend/src/controllers/lead.controller.ts) (Lead controller), [`backend/src/app.ts`](https://github.com/sakshi07102005/li-crm/blob/main/backend/src/app.ts) (Express API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_clients["CRM clients"]
  node_web["Web application"]
  node_mobile["Mobile application"]
end

subgraph group_api["API and access"]
  node_apiapp["Express API<br/>[app.ts]"]
  node_lead_routes["Lead routes<br/>[lead.routes.ts]"]
  node_authz["Authentication and RBAC"]
  node_scope["Data scoping<br/>[scope.service.ts]"]
end

subgraph group_sales["Sales operations"]
  node_lead_controller["Lead controller<br/>[lead.controller.ts]"]
  node_lead_service["Lead management<br/>[lead.service.ts]"]
  node_lead_validation["Lead validation<br/>[lead.validator.ts]"]
  node_normalizers["Lead normalization<br/>[leadNormalizers.ts]"]
  node_postgres[("PostgreSQL<br/>[pool.ts]")]
  node_customers["Companies and contacts"]
  node_pipeline["Follow-ups and tasks"]
end

subgraph group_insights["Engagement and insights"]
  node_activity["Activity tracking"]
  node_reporting["Reports and imports"]
  node_audit["Audit trail<br/>[audit.service.ts]"]
  node_notifications["Notifications and email"]
  node_reminders["Reminder scheduler"]
end

node_user(("CRM user"))

node_user -->|"uses"| node_web
node_user -->|"uses"| node_mobile
node_web -.->|"submits requests"| node_apiapp
node_mobile -.->|"submits requests"| node_apiapp
node_apiapp -->|"mounts routes"| node_lead_routes
node_lead_routes -->|"applies access checks"| node_authz
node_lead_routes -->|"dispatches requests"| node_lead_controller
node_lead_controller -->|"invokes operations"| node_lead_service
node_lead_controller -->|"validates input"| node_lead_validation
node_lead_service -->|"queries and writes"| node_postgres
node_lead_service -->|"normalizes search"| node_normalizers
node_lead_service -->|"checks data scope"| node_scope
node_lead_service -->|"creates notifications"| node_notifications
node_reminders -->|"sends reminders"| node_notifications
node_lead_service -->|"records activity"| node_activity
node_lead_service -->|"records audit"| node_audit

click node_web "https://github.com/sakshi07102005/li-crm/tree/main/web/src"
click node_mobile "https://github.com/sakshi07102005/li-crm/tree/main/mobile"
click node_apiapp "https://github.com/sakshi07102005/li-crm/blob/main/backend/src/app.ts"
click node_lead_routes "https://github.com/sakshi07102005/li-crm/blob/main/backend/src/routes/lead.routes.ts"
click node_authz "https://github.com/sakshi07102005/li-crm/tree/main/backend/src/middleware"
click node_lead_controller "https://github.com/sakshi07102005/li-crm/blob/main/backend/src/controllers/lead.controller.ts"
click node_lead_service "https://github.com/sakshi07102005/li-crm/blob/main/backend/src/services/lead.service.ts"
click node_lead_validation "https://github.com/sakshi07102005/li-crm/blob/main/backend/src/validators/lead.validator.ts"
click node_normalizers "https://github.com/sakshi07102005/li-crm/blob/main/backend/src/utils/leadNormalizers.ts"
click node_scope "https://github.com/sakshi07102005/li-crm/blob/main/backend/src/services/scope.service.ts"
click node_postgres "https://github.com/sakshi07102005/li-crm/blob/main/backend/src/db/pool.ts"
click node_customers "https://github.com/sakshi07102005/li-crm/tree/main/backend/src/services"
click node_pipeline "https://github.com/sakshi07102005/li-crm/tree/main/backend/src/services"
click node_activity "https://github.com/sakshi07102005/li-crm/blob/main/backend/src/services/activity.service.ts"
click node_reporting "https://github.com/sakshi07102005/li-crm/tree/main/backend/src/services"
click node_audit "https://github.com/sakshi07102005/li-crm/blob/main/backend/src/services/audit.service.ts"
click node_notifications "https://github.com/sakshi07102005/li-crm/blob/main/backend/src/services/notification.service.ts"
click node_reminders "https://github.com/sakshi07102005/li-crm/blob/main/backend/src/jobs/followupReminders.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_web,node_mobile,node_user toneBlue
class node_apiapp,node_lead_routes,node_authz,node_scope toneAmber
class node_lead_controller,node_lead_service,node_lead_validation,node_normalizers,node_postgres,node_customers,node_pipeline toneMint
class node_activity,node_reporting,node_audit,node_notifications,node_reminders toneRose
```

## Components

### CRM clients

- [Web application](https://github.com/sakshi07102005/li-crm/tree/main/web/src): `web/src`
- [Mobile application](https://github.com/sakshi07102005/li-crm/tree/main/mobile): `mobile`

### API and access

- [Express API](https://github.com/sakshi07102005/li-crm/blob/main/backend/src/app.ts): `backend/src/app.ts`
- [Lead routes](https://github.com/sakshi07102005/li-crm/blob/main/backend/src/routes/lead.routes.ts): `backend/src/routes/lead.routes.ts`
- [Authentication and RBAC](https://github.com/sakshi07102005/li-crm/tree/main/backend/src/middleware): `backend/src/middleware`
- [Data scoping](https://github.com/sakshi07102005/li-crm/blob/main/backend/src/services/scope.service.ts): `backend/src/services/scope.service.ts`

### Sales operations

- [Lead controller](https://github.com/sakshi07102005/li-crm/blob/main/backend/src/controllers/lead.controller.ts): `backend/src/controllers/lead.controller.ts`
- [Lead management](https://github.com/sakshi07102005/li-crm/blob/main/backend/src/services/lead.service.ts): `backend/src/services/lead.service.ts`
- [Lead validation](https://github.com/sakshi07102005/li-crm/blob/main/backend/src/validators/lead.validator.ts): `backend/src/validators/lead.validator.ts`
- [Lead normalization](https://github.com/sakshi07102005/li-crm/blob/main/backend/src/utils/leadNormalizers.ts): `backend/src/utils/leadNormalizers.ts`
- [PostgreSQL](https://github.com/sakshi07102005/li-crm/blob/main/backend/src/db/pool.ts): `backend/src/db/pool.ts`
- [Companies and contacts](https://github.com/sakshi07102005/li-crm/tree/main/backend/src/services): `backend/src/services`
- [Follow-ups and tasks](https://github.com/sakshi07102005/li-crm/tree/main/backend/src/services): `backend/src/services`

### Engagement and insights

- [Activity tracking](https://github.com/sakshi07102005/li-crm/blob/main/backend/src/services/activity.service.ts): `backend/src/services/activity.service.ts`
- [Reports and imports](https://github.com/sakshi07102005/li-crm/tree/main/backend/src/services): `backend/src/services`
- [Audit trail](https://github.com/sakshi07102005/li-crm/blob/main/backend/src/services/audit.service.ts): `backend/src/services/audit.service.ts`
- [Notifications and email](https://github.com/sakshi07102005/li-crm/blob/main/backend/src/services/notification.service.ts): `backend/src/services/notification.service.ts`
- [Reminder scheduler](https://github.com/sakshi07102005/li-crm/blob/main/backend/src/jobs/followupReminders.ts): `backend/src/jobs/followupReminders.ts`

### Other components

- **CRM user**

## Connections

- CRM user → Web application: uses (evidence: `README.md`)
- CRM user → Mobile application: uses (evidence: `README.md`)
- Web application → Express API: submits requests
- Mobile application → Express API: submits requests
- Express API → Lead routes: mounts routes (evidence: `backend/src/app.ts`)
- Lead routes → Authentication and RBAC: applies access checks (evidence: `backend/src/routes/lead.routes.ts`)
- Lead routes → Lead controller: dispatches requests (evidence: `backend/src/routes/lead.routes.ts`)
- Lead controller → Lead management: invokes operations (evidence: `backend/src/controllers/lead.controller.ts`)
- Lead controller → Lead validation: validates input (evidence: `backend/src/controllers/lead.controller.ts`)
- Lead management → PostgreSQL: queries and writes (evidence: `backend/src/services/lead.service.ts`)
- Lead management → Lead normalization: normalizes search (evidence: `backend/src/services/lead.service.ts`)
- Lead management → Data scoping: checks data scope (evidence: `backend/src/services/lead.service.ts`)
- Lead management → Notifications and email: creates notifications (evidence: `backend/src/services/lead.service.ts`)
- Reminder scheduler → Notifications and email: sends reminders (evidence: `backend/src/jobs/followupReminders.ts`)
- Lead management → Activity tracking: records activity (evidence: `backend/src/services/lead.service.ts`)
- Lead management → Audit trail: records audit (evidence: `backend/src/services/lead.service.ts`)
