# qf-mj/crm-al-mohtaref architecture

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

- Interactive diagram: https://gitdiagram.com/qf-mj/crm-al-mohtaref
- Repository: https://github.com/qf-mj/crm-al-mohtaref

## Overview

Al-Muhtaref CRM is a web CRM for coordinating customer records and departmental work. Staff enter through the client, navigate feature routes, and use implemented contacts and user-management screens; the server exposes API controllers that dispatch application requests, with repositories backed by the shared database context. The README also describes lifecycle, campaigns, issues, reminders, reporting, WhatsApp, and Sheets capabilities, but this tree and the sampled source do not establish their runtime wiring. Those documented areas are shown as distinct subsystems without asserted implementation flows.

Main entry points: [`src/Server/CRM.AlMohtaref.Domain/Entities/Contacts`](https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Server/CRM.AlMohtaref.Domain/Entities/Contacts) (Customer records), [`src/Server/CRM.AlMohtaref.Infrastructure/Data/AppDbContext.cs`](https://github.com/qf-mj/crm-al-mohtaref/blob/main/src/Server/CRM.AlMohtaref.Infrastructure/Data/AppDbContext.cs) (CRM data context), [`src/Client/src/app/router/index.tsx`](https://github.com/qf-mj/crm-al-mohtaref/blob/main/src/Client/src/app/router/index.tsx) (Route map), [`src/Server/CRM.AlMohtaref.Domain/Entities/Campaigns`](https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Server/CRM.AlMohtaref.Domain/Entities/Campaigns) (Campaign lifecycle)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Staff client"]
  node_clientapp["Web client<br/>[App.tsx]"]
  node_router["Route map<br/>[index.tsx]"]
  node_userpages["User management"]
  node_contactspage["Contact directory<br/>[ContactsPage.tsx]"]
  node_authui["Sign-in"]
  node_campaignui["Campaign workspace"]
  node_issuesui["Issue tracking"]
  node_tasksui["Follow-up tasks"]
  node_communications["Communications"]
  node_notifications["Notifications"]
  node_academic["Academic guidance"]
end

subgraph group_api["API boundary"]
  node_apiusers["User endpoints<br/>[UsersController.cs]"]
  node_apiauth["Authentication endpoint<br/>[AuthController.cs]"]
  node_apicontacts["Contact endpoints"]
  node_apicampaign["Campaign endpoints"]
end

subgraph group_app["Application logic"]
  node_userslogic["User handlers<br/>[Users]"]
  node_contactslogic["Contact search"]
  node_lookupslogic["Lookup queries"]
end

subgraph group_infra["Persistence"]
  node_userrepo["User repository<br/>[UserRepository.cs]"]
  node_dbcontext["CRM data context<br/>[AppDbContext.cs]"]
end

subgraph group_domain["CRM capabilities"]
  node_crmrecords["Customer records<br/>[Contacts]"]
  node_campaigns["Campaign lifecycle<br/>[Campaigns]"]
  node_questionconfig["Question configuration<br/>[Questions]"]
  node_integrations["WhatsApp and Sheets"]
end

node_staff(("CRM staff"))
node_externalservices(("WhatsApp / Google Sheets"))

node_staff -->|"uses"| node_clientapp
node_clientapp -->|"loads routes"| node_router
node_router -->|"routes users"| node_userpages
node_router -->|"routes contacts"| node_contactspage
node_apiusers -->|"dispatches requests"| node_userslogic
node_apiauth -.->|"serves sign-in"| node_authui
node_apicontacts -.->|"handles search"| node_contactslogic
node_apicampaign -.->|"manages campaigns"| node_campaigns
node_userslogic -->|"searches users"| node_userrepo
node_contactslogic -.->|"queries contacts"| node_crmrecords
node_lookupslogic -.->|"loads lookup data"| node_crmrecords
node_userrepo -->|"queries and updates"| node_dbcontext
node_dbcontext -->|"stores CRM entities"| node_crmrecords
node_dbcontext -->|"stores entities"| node_campaigns
node_dbcontext -->|"stores entities"| node_questionconfig
node_tasksui -.->|"follow-up alerts"| node_notifications
node_communications -.->|"logs conversations"| node_integrations
node_integrations -.->|"integrates with"| node_externalservices
node_issuesui -.->|"links customer issues"| node_crmrecords
node_campaignui -.->|"tracks effectiveness"| node_campaigns
node_academic -.->|"supports guidance"| node_crmrecords

click node_clientapp "https://github.com/qf-mj/crm-al-mohtaref/blob/main/src/Client/src/app/App.tsx"
click node_router "https://github.com/qf-mj/crm-al-mohtaref/blob/main/src/Client/src/app/router/index.tsx"
click node_userpages "https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Client/src/features/users/pages"
click node_contactspage "https://github.com/qf-mj/crm-al-mohtaref/blob/main/src/Client/src/features/clients/pages/ContactsPage.tsx"
click node_authui "https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Client/src/features/auth"
click node_campaignui "https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Client/src/features/campaigns"
click node_issuesui "https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Client/src/features/issues"
click node_tasksui "https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Client/src/features/tasks"
click node_communications "https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Client/src/features/communications"
click node_notifications "https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Client/src/features/notifications"
click node_academic "https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Client/src/features/academic"
click node_apiusers "https://github.com/qf-mj/crm-al-mohtaref/blob/main/src/Server/CRM.AlMohtaref.Api/Controllers/UsersController.cs"
click node_apiauth "https://github.com/qf-mj/crm-al-mohtaref/blob/main/src/Server/CRM.AlMohtaref.Api/Controllers/AuthController.cs"
click node_apicontacts "https://github.com/qf-mj/crm-al-mohtaref/blob/main/src/Server/CRM.AlMohtaref.Api/Controllers/ContactsController.cs"
click node_apicampaign "https://github.com/qf-mj/crm-al-mohtaref/blob/main/src/Server/CRM.AlMohtaref.Api/Controllers/CampaignsController.cs"
click node_userslogic "https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Server/CRM.AlMohtaref.Application/Features/Users"
click node_contactslogic "https://github.com/qf-mj/crm-al-mohtaref/blob/main/src/Server/CRM.AlMohtaref.Application/Features/Contacts/GetContacts/GetContactsQueryHandler.cs"
click node_lookupslogic "https://github.com/qf-mj/crm-al-mohtaref/blob/main/src/Server/CRM.AlMohtaref.Application/Features/Lookups/GetLookupsQueryHandler.cs"
click node_userrepo "https://github.com/qf-mj/crm-al-mohtaref/blob/main/src/Server/CRM.AlMohtaref.Infrastructure/Repositories/UserRepository.cs"
click node_dbcontext "https://github.com/qf-mj/crm-al-mohtaref/blob/main/src/Server/CRM.AlMohtaref.Infrastructure/Data/AppDbContext.cs"
click node_crmrecords "https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Server/CRM.AlMohtaref.Domain/Entities/Contacts"
click node_campaigns "https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Server/CRM.AlMohtaref.Domain/Entities/Campaigns"
click node_questionconfig "https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Server/CRM.AlMohtaref.Domain/Entities/Questions"

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_clientapp,node_router,node_userpages,node_contactspage,node_authui,node_campaignui,node_issuesui,node_tasksui,node_communications,node_notifications,node_academic toneBlue
class node_apiusers,node_apiauth,node_apicontacts,node_apicampaign toneAmber
class node_userslogic,node_contactslogic,node_lookupslogic toneMint
class node_userrepo,node_dbcontext toneRose
class node_crmrecords,node_campaigns,node_questionconfig,node_integrations,node_staff,node_externalservices toneIndigo
```

## Components

### Staff client

- [Web client](https://github.com/qf-mj/crm-al-mohtaref/blob/main/src/Client/src/app/App.tsx): `src/Client/src/app/App.tsx`
- [Route map](https://github.com/qf-mj/crm-al-mohtaref/blob/main/src/Client/src/app/router/index.tsx): `src/Client/src/app/router/index.tsx`
- [User management](https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Client/src/features/users/pages): `src/Client/src/features/users/pages`
- [Contact directory](https://github.com/qf-mj/crm-al-mohtaref/blob/main/src/Client/src/features/clients/pages/ContactsPage.tsx): `src/Client/src/features/clients/pages/ContactsPage.tsx`
- [Sign-in](https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Client/src/features/auth): `src/Client/src/features/auth`
- [Campaign workspace](https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Client/src/features/campaigns): `src/Client/src/features/campaigns`
- [Issue tracking](https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Client/src/features/issues): `src/Client/src/features/issues`
- [Follow-up tasks](https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Client/src/features/tasks): `src/Client/src/features/tasks`
- [Communications](https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Client/src/features/communications): `src/Client/src/features/communications`
- [Notifications](https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Client/src/features/notifications): `src/Client/src/features/notifications`
- [Academic guidance](https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Client/src/features/academic): `src/Client/src/features/academic`

### API boundary

- [User endpoints](https://github.com/qf-mj/crm-al-mohtaref/blob/main/src/Server/CRM.AlMohtaref.Api/Controllers/UsersController.cs): `src/Server/CRM.AlMohtaref.Api/Controllers/UsersController.cs`
- [Authentication endpoint](https://github.com/qf-mj/crm-al-mohtaref/blob/main/src/Server/CRM.AlMohtaref.Api/Controllers/AuthController.cs): `src/Server/CRM.AlMohtaref.Api/Controllers/AuthController.cs`
- [Contact endpoints](https://github.com/qf-mj/crm-al-mohtaref/blob/main/src/Server/CRM.AlMohtaref.Api/Controllers/ContactsController.cs): `src/Server/CRM.AlMohtaref.Api/Controllers/ContactsController.cs`
- [Campaign endpoints](https://github.com/qf-mj/crm-al-mohtaref/blob/main/src/Server/CRM.AlMohtaref.Api/Controllers/CampaignsController.cs): `src/Server/CRM.AlMohtaref.Api/Controllers/CampaignsController.cs`

### Application logic

- [User handlers](https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Server/CRM.AlMohtaref.Application/Features/Users): `src/Server/CRM.AlMohtaref.Application/Features/Users`
- [Contact search](https://github.com/qf-mj/crm-al-mohtaref/blob/main/src/Server/CRM.AlMohtaref.Application/Features/Contacts/GetContacts/GetContactsQueryHandler.cs): `src/Server/CRM.AlMohtaref.Application/Features/Contacts/GetContacts/GetContactsQueryHandler.cs`
- [Lookup queries](https://github.com/qf-mj/crm-al-mohtaref/blob/main/src/Server/CRM.AlMohtaref.Application/Features/Lookups/GetLookupsQueryHandler.cs): `src/Server/CRM.AlMohtaref.Application/Features/Lookups/GetLookupsQueryHandler.cs`

### Persistence

- [User repository](https://github.com/qf-mj/crm-al-mohtaref/blob/main/src/Server/CRM.AlMohtaref.Infrastructure/Repositories/UserRepository.cs): `src/Server/CRM.AlMohtaref.Infrastructure/Repositories/UserRepository.cs`
- [CRM data context](https://github.com/qf-mj/crm-al-mohtaref/blob/main/src/Server/CRM.AlMohtaref.Infrastructure/Data/AppDbContext.cs): `src/Server/CRM.AlMohtaref.Infrastructure/Data/AppDbContext.cs`

### CRM capabilities

- [Customer records](https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Server/CRM.AlMohtaref.Domain/Entities/Contacts): `src/Server/CRM.AlMohtaref.Domain/Entities/Contacts`
- [Campaign lifecycle](https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Server/CRM.AlMohtaref.Domain/Entities/Campaigns): `src/Server/CRM.AlMohtaref.Domain/Entities/Campaigns`
- [Question configuration](https://github.com/qf-mj/crm-al-mohtaref/tree/main/src/Server/CRM.AlMohtaref.Domain/Entities/Questions): `src/Server/CRM.AlMohtaref.Domain/Entities/Questions`
- **WhatsApp and Sheets**

### Other components

- **CRM staff**
- **WhatsApp / Google Sheets**

## Connections

- CRM staff → Web client: uses (evidence: `README.md`)
- Web client → Route map: loads routes (evidence: `src/Client/src/app/App.tsx`)
- Route map → User management: routes users
- Route map → Contact directory: routes contacts
- User endpoints → User handlers: dispatches requests (evidence: `src/Server/CRM.AlMohtaref.Api/Controllers/UsersController.cs`)
- Authentication endpoint → Sign-in: serves sign-in
- Contact endpoints → Contact search: handles search
- Campaign endpoints → Campaign lifecycle: manages campaigns
- User handlers → User repository: searches users (evidence: `src/Server/CRM.AlMohtaref.Application/Features/Users/GetUsers/GetUsersQueryHandler.cs`)
- Contact search → Customer records: queries contacts
- Lookup queries → Customer records: loads lookup data
- User repository → CRM data context: queries and updates (evidence: `src/Server/CRM.AlMohtaref.Infrastructure/Repositories/UserRepository.cs`)
- CRM data context → Customer records: stores CRM entities (evidence: `src/Server/CRM.AlMohtaref.Infrastructure/Data/AppDbContext.cs`)
- CRM data context → Campaign lifecycle: stores entities (evidence: `src/Server/CRM.AlMohtaref.Infrastructure/Data/AppDbContext.cs`)
- CRM data context → Question configuration: stores entities (evidence: `src/Server/CRM.AlMohtaref.Infrastructure/Data/AppDbContext.cs`)
- Follow-up tasks → Notifications: follow-up alerts (evidence: `README.md`)
- Communications → WhatsApp and Sheets: logs conversations (evidence: `README.md`)
- WhatsApp and Sheets → WhatsApp / Google Sheets: integrates with (evidence: `README.md`)
- Issue tracking → Customer records: links customer issues (evidence: `README.md`)
- Campaign workspace → Campaign lifecycle: tracks effectiveness (evidence: `README.md`)
- Academic guidance → Customer records: supports guidance (evidence: `README.md`)
