# go2ismail/free-crm architecture

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

- Interactive diagram: https://gitdiagram.com/go2ismail/free-crm
- Repository: https://github.com/go2ismail/free-crm

## Overview

Free CRM is a monolithic CRM API for managing campaigns, leads, sales activity, budgets and expenses, with sales/purchase operations, dashboards, files, and user administration. The principal workflow is a user request entering the ASP.NET API, being dispatched through CQRS/MediatR application handlers, and accessing application data through EF Core. The README establishes the broad architecture and feature set; sampled controller, handler, service, and context files support only selected internal connections, so other subsystem links are left unspecified.

Main entry points: [`Infrastructure/Infrastructure/DataAccessManager/EFCore/Repositories/CommadRepository.cs`](https://github.com/go2ismail/free-crm/blob/master/Infrastructure/Infrastructure/DataAccessManager/EFCore/Repositories/CommadRepository.cs) (Command repository), [`Infrastructure/Infrastructure/DataAccessManager/EFCore/Repositories/UnitOfWork.cs`](https://github.com/go2ismail/free-crm/blob/master/Infrastructure/Infrastructure/DataAccessManager/EFCore/Repositories/UnitOfWork.cs) (Unit of work), [`Infrastructure/Infrastructure/DataAccessManager/EFCore/Contexts/DataContext.cs`](https://github.com/go2ismail/free-crm/blob/master/Infrastructure/Infrastructure/DataAccessManager/EFCore/Contexts/DataContext.cs) (EF Core context), [`Core/Application/Features/DashboardManager/Queries`](https://github.com/go2ismail/free-crm/tree/master/Core/Application/Features/DashboardManager/Queries) (Dashboards and reports)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["API entry"]
  node_api["ASP.NET API"]
end

subgraph group_crm["CRM workflow"]
  node_campaign["Campaigns, budgets, expenses"]
  node_leads["Leads and pipeline"]
  node_leadactivity["Lead contacts and activity"]
  node_teams["Sales teams"]
  node_dashboard["Dashboards and reports"]
end

subgraph group_commerce["Business operations"]
  node_customers["Customers and vendors"]
  node_catalog["Products and tax"]
  node_salesorders["Sales orders"]
  node_purchaseorders["Purchase orders"]
end

subgraph group_identity["Identity and files"]
  node_securityapi["Security endpoints"]
  node_security["Identity and tokens<br/>[SecurityService.cs]"]
  node_files["Document and image files"]
end

subgraph group_core["Application and persistence"]
  node_cqrs["CQRS handlers"]
  node_querycontext["Query context<br/>[QueryContext.cs]"]
  node_repository["Command repository"]
  node_unitofwork["Unit of work<br/>[UnitOfWork.cs]"]
  node_datacontext["EF Core context<br/>[DataContext.cs]"]
  node_domain["CRM domain entities"]
end

node_user(("CRM user"))
node_sql[("SQL database")]

node_user -->|"uses"| node_api
node_api -->|"dispatches requests"| node_cqrs
node_dashboard -->|"queries"| node_querycontext
node_querycontext -->|"uses"| node_datacontext
node_dashboard -->|"reads leads"| node_domain
node_securityapi -->|"dispatches requests"| node_cqrs
node_files -->|"persists metadata"| node_repository
node_files -->|"saves changes"| node_unitofwork
node_salesorders -->|"uses repository"| node_repository
node_salesorders -->|"saves changes"| node_unitofwork
node_purchaseorders -->|"uses repository"| node_repository
node_purchaseorders -->|"saves changes"| node_unitofwork
node_repository -.->|"accesses data"| node_datacontext
node_unitofwork -.->|"commits changes"| node_datacontext
node_datacontext -.->|"stores CRM data"| node_sql

click node_api "https://github.com/go2ismail/free-crm/tree/master/Presentation/ASPNET/BackEnd/Controllers"
click node_campaign "https://github.com/go2ismail/free-crm/tree/master/Core/Application/Features"
click node_leads "https://github.com/go2ismail/free-crm/tree/master/Core/Application/Features/LeadManager"
click node_leadactivity "https://github.com/go2ismail/free-crm/tree/master/Core/Application/Features"
click node_teams "https://github.com/go2ismail/free-crm/tree/master/Core/Application/Features/SalesTeamManager"
click node_dashboard "https://github.com/go2ismail/free-crm/tree/master/Core/Application/Features/DashboardManager/Queries"
click node_customers "https://github.com/go2ismail/free-crm/tree/master/Core/Application/Features"
click node_catalog "https://github.com/go2ismail/free-crm/tree/master/Core/Application/Features"
click node_salesorders "https://github.com/go2ismail/free-crm/tree/master/Core/Application/Features/SalesOrderManager"
click node_purchaseorders "https://github.com/go2ismail/free-crm/tree/master/Core/Application/Features/PurchaseOrderManager"
click node_securityapi "https://github.com/go2ismail/free-crm/blob/master/Presentation/ASPNET/BackEnd/Controllers/SecurityController.cs"
click node_security "https://github.com/go2ismail/free-crm/blob/master/Infrastructure/Infrastructure/SecurityManager/AspNetIdentity/SecurityService.cs"
click node_files "https://github.com/go2ismail/free-crm/blob/master/Infrastructure/Infrastructure/FileDocumentManager/FileDocumentService.cs"
click node_cqrs "https://github.com/go2ismail/free-crm/tree/master/Core/Application/Features"
click node_querycontext "https://github.com/go2ismail/free-crm/blob/master/Infrastructure/Infrastructure/DataAccessManager/EFCore/Contexts/QueryContext.cs"
click node_repository "https://github.com/go2ismail/free-crm/blob/master/Infrastructure/Infrastructure/DataAccessManager/EFCore/Repositories/CommadRepository.cs"
click node_unitofwork "https://github.com/go2ismail/free-crm/blob/master/Infrastructure/Infrastructure/DataAccessManager/EFCore/Repositories/UnitOfWork.cs"
click node_datacontext "https://github.com/go2ismail/free-crm/blob/master/Infrastructure/Infrastructure/DataAccessManager/EFCore/Contexts/DataContext.cs"
click node_domain "https://github.com/go2ismail/free-crm/tree/master/Core/Domain/Entities"

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_api,node_user toneBlue
class node_campaign,node_leads,node_leadactivity,node_teams,node_dashboard,node_sql toneAmber
class node_customers,node_catalog,node_salesorders,node_purchaseorders toneMint
class node_securityapi,node_security,node_files toneRose
class node_cqrs,node_querycontext,node_repository,node_unitofwork,node_datacontext,node_domain toneIndigo
```

## Components

### API entry

- [ASP.NET API](https://github.com/go2ismail/free-crm/tree/master/Presentation/ASPNET/BackEnd/Controllers): `Presentation/ASPNET/BackEnd/Controllers`

### CRM workflow

- [Campaigns, budgets, expenses](https://github.com/go2ismail/free-crm/tree/master/Core/Application/Features): `Core/Application/Features`
- [Leads and pipeline](https://github.com/go2ismail/free-crm/tree/master/Core/Application/Features/LeadManager): `Core/Application/Features/LeadManager`
- [Lead contacts and activity](https://github.com/go2ismail/free-crm/tree/master/Core/Application/Features): `Core/Application/Features`
- [Sales teams](https://github.com/go2ismail/free-crm/tree/master/Core/Application/Features/SalesTeamManager): `Core/Application/Features/SalesTeamManager`
- [Dashboards and reports](https://github.com/go2ismail/free-crm/tree/master/Core/Application/Features/DashboardManager/Queries): `Core/Application/Features/DashboardManager/Queries`

### Business operations

- [Customers and vendors](https://github.com/go2ismail/free-crm/tree/master/Core/Application/Features): `Core/Application/Features`
- [Products and tax](https://github.com/go2ismail/free-crm/tree/master/Core/Application/Features): `Core/Application/Features`
- [Sales orders](https://github.com/go2ismail/free-crm/tree/master/Core/Application/Features/SalesOrderManager): `Core/Application/Features/SalesOrderManager`
- [Purchase orders](https://github.com/go2ismail/free-crm/tree/master/Core/Application/Features/PurchaseOrderManager): `Core/Application/Features/PurchaseOrderManager`

### Identity and files

- [Security endpoints](https://github.com/go2ismail/free-crm/blob/master/Presentation/ASPNET/BackEnd/Controllers/SecurityController.cs): `Presentation/ASPNET/BackEnd/Controllers/SecurityController.cs`
- [Identity and tokens](https://github.com/go2ismail/free-crm/blob/master/Infrastructure/Infrastructure/SecurityManager/AspNetIdentity/SecurityService.cs): `Infrastructure/Infrastructure/SecurityManager/AspNetIdentity/SecurityService.cs`
- [Document and image files](https://github.com/go2ismail/free-crm/blob/master/Infrastructure/Infrastructure/FileDocumentManager/FileDocumentService.cs): `Infrastructure/Infrastructure/FileDocumentManager/FileDocumentService.cs`

### Application and persistence

- [CQRS handlers](https://github.com/go2ismail/free-crm/tree/master/Core/Application/Features): `Core/Application/Features`
- [Query context](https://github.com/go2ismail/free-crm/blob/master/Infrastructure/Infrastructure/DataAccessManager/EFCore/Contexts/QueryContext.cs): `Infrastructure/Infrastructure/DataAccessManager/EFCore/Contexts/QueryContext.cs`
- [Command repository](https://github.com/go2ismail/free-crm/blob/master/Infrastructure/Infrastructure/DataAccessManager/EFCore/Repositories/CommadRepository.cs): `Infrastructure/Infrastructure/DataAccessManager/EFCore/Repositories/CommadRepository.cs`
- [Unit of work](https://github.com/go2ismail/free-crm/blob/master/Infrastructure/Infrastructure/DataAccessManager/EFCore/Repositories/UnitOfWork.cs): `Infrastructure/Infrastructure/DataAccessManager/EFCore/Repositories/UnitOfWork.cs`
- [EF Core context](https://github.com/go2ismail/free-crm/blob/master/Infrastructure/Infrastructure/DataAccessManager/EFCore/Contexts/DataContext.cs): `Infrastructure/Infrastructure/DataAccessManager/EFCore/Contexts/DataContext.cs`
- [CRM domain entities](https://github.com/go2ismail/free-crm/tree/master/Core/Domain/Entities): `Core/Domain/Entities`

### Other components

- **CRM user**
- **SQL database**

## Connections

- CRM user → ASP.NET API: uses (evidence: `README.md`)
- ASP.NET API → CQRS handlers: dispatches requests (evidence: `Presentation/ASPNET/BackEnd/Controllers/SecurityController.cs`)
- Dashboards and reports → Query context: queries (evidence: `Core/Application/Features/DashboardManager/Queries/GetLeadPipelineFunnel.cs`)
- Query context → EF Core context: uses (evidence: `Infrastructure/Infrastructure/DataAccessManager/EFCore/Contexts/QueryContext.cs`)
- Dashboards and reports → CRM domain entities: reads leads (evidence: `Core/Application/Features/DashboardManager/Queries/GetLeadPipelineFunnel.cs`)
- Security endpoints → CQRS handlers: dispatches requests (evidence: `Presentation/ASPNET/BackEnd/Controllers/SecurityController.cs`)
- Document and image files → Command repository: persists metadata (evidence: `Infrastructure/Infrastructure/FileDocumentManager/FileDocumentService.cs`)
- Document and image files → Unit of work: saves changes (evidence: `Infrastructure/Infrastructure/FileDocumentManager/FileDocumentService.cs`)
- Sales orders → Command repository: uses repository (evidence: `Core/Application/Features/SalesOrderManager/SalesOrderService.cs`)
- Sales orders → Unit of work: saves changes (evidence: `Core/Application/Features/SalesOrderManager/SalesOrderService.cs`)
- Purchase orders → Command repository: uses repository (evidence: `Core/Application/Features/PurchaseOrderManager/PurchaseOrderService.cs`)
- Purchase orders → Unit of work: saves changes (evidence: `Core/Application/Features/PurchaseOrderManager/PurchaseOrderService.cs`)
- Command repository → EF Core context: accesses data
- Unit of work → EF Core context: commits changes
- EF Core context → SQL database: stores CRM data
