# sandybrownca/crm architecture

> Architecture diagram of the GitHub repository sandybrownca/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/sandybrownca/crm
- Repository: https://github.com/sandybrownca/crm

## Overview

Business Operations CRM is a React and ASP.NET Core application for customer records and interactions, invoice issuance, payment tracking, dashboard reporting, user administration, and simulated ERP synchronization. Users work through the web app; its pages call API clients, while backend endpoints delegate business operations to infrastructure services that persist through EF Core. The sampled service code confirms invoice, payment, customer, dashboard, and ERP behaviors; several endpoint and UI links are based on the README or source index because those files were not excerpted.

Main entry points: [`src/api/BusinessOperations.Api/Endpoints`](https://github.com/sandybrownca/crm/tree/master/src/api/BusinessOperations.Api/Endpoints) (Versioned API endpoints), [`src/api/BusinessOperations.Infrastructure/Persistence/AppDbContext.cs`](https://github.com/sandybrownca/crm/blob/master/src/api/BusinessOperations.Infrastructure/Persistence/AppDbContext.cs) (EF Core context), [`src/web/src/App.tsx`](https://github.com/sandybrownca/crm/blob/master/src/web/src/App.tsx) (React app routing), [`src/web/src/api/client.ts`](https://github.com/sandybrownca/crm/blob/master/src/web/src/api/client.ts) (Web API clients)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["React app routing<br/>[App.tsx]"]
  node_authctx["Session context<br/>[AuthContext.tsx]"]
  node_customersui["Customer workspace<br/>[CustomersPage.tsx]"]
  node_invoicesui["Invoice workspace<br/>[InvoicesPage.tsx]"]
  node_dashboardui["Dashboard view<br/>[DashboardPage.tsx]"]
  node_usersui["User workspace<br/>[UsersPage.tsx]"]
  node_webapi["Web API clients<br/>[client.ts]"]
  node_authapi["Auth client<br/>[auth.ts]"]
end

subgraph group_api["HTTP API"]
  node_endpoints["Versioned API endpoints<br/>[Endpoints]"]
end

subgraph group_operations["Business operations"]
  node_customers["Customer records<br/>[CustomerService.cs]"]
  node_interactions["Customer interactions"]
  node_invoices["Invoice lifecycle<br/>[InvoiceService.cs]"]
  node_payments["Payment processing<br/>[PaymentService.cs]"]
  node_dashboard["Business reporting"]
  node_erp["ERP synchronization<br/>[ErpSyncService.cs]"]
  node_erpclient["Simulated ERP adapter"]
end

subgraph group_identity["Authentication and administration"]
  node_auth["Cookie authentication<br/>[AuthEndpoints.cs]"]
  node_useradmin["User and role admin"]
end

subgraph group_persistence["Persistence"]
  node_dbcontext["EF Core context<br/>[AppDbContext.cs]"]
  node_sql[("SQL Server data")]
end

node_user(("CRM user"))

node_user -->|"uses"| node_app
node_app -->|"provides session"| node_authctx
node_app -->|"routes to"| node_customersui
node_app -->|"routes to"| node_invoicesui
node_app -->|"routes to"| node_dashboardui
node_app -->|"routes to"| node_usersui
node_authctx -->|"calls"| node_authapi
node_customersui -->|"requests data"| node_webapi
node_invoicesui -->|"requests data"| node_webapi
node_usersui -->|"requests data"| node_webapi
node_dashboardui -.->|"requests data"| node_webapi
node_webapi -.->|"HTTP requests"| node_endpoints
node_authapi -.->|"HTTP requests"| node_auth
node_endpoints -.->|"delegates"| node_customers
node_endpoints -.->|"delegates"| node_interactions
node_endpoints -.->|"delegates"| node_invoices
node_endpoints -.->|"delegates"| node_payments
node_endpoints -.->|"delegates"| node_dashboard
node_endpoints -.->|"delegates"| node_erp
node_endpoints -.->|"delegates"| node_useradmin
node_invoices -->|"requests sync"| node_erp
node_erp -->|"submits invoice"| node_erpclient
node_customers -->|"reads and writes"| node_dbcontext
node_interactions -->|"reads and writes"| node_dbcontext
node_invoices -->|"reads and writes"| node_dbcontext
node_payments -->|"transactions"| node_dbcontext
node_dashboard -->|"queries"| node_dbcontext
node_erp -->|"reads and writes"| node_dbcontext
node_useradmin -.->|"manages users"| node_dbcontext
node_auth -.->|"uses identity store"| node_dbcontext
node_dbcontext -.->|"persists"| node_sql

click node_app "https://github.com/sandybrownca/crm/blob/master/src/web/src/App.tsx"
click node_authctx "https://github.com/sandybrownca/crm/blob/master/src/web/src/auth/AuthContext.tsx"
click node_customersui "https://github.com/sandybrownca/crm/blob/master/src/web/src/pages/CustomersPage.tsx"
click node_invoicesui "https://github.com/sandybrownca/crm/blob/master/src/web/src/pages/InvoicesPage.tsx"
click node_dashboardui "https://github.com/sandybrownca/crm/blob/master/src/web/src/pages/DashboardPage.tsx"
click node_usersui "https://github.com/sandybrownca/crm/blob/master/src/web/src/pages/UsersPage.tsx"
click node_webapi "https://github.com/sandybrownca/crm/blob/master/src/web/src/api/client.ts"
click node_authapi "https://github.com/sandybrownca/crm/blob/master/src/web/src/api/auth.ts"
click node_endpoints "https://github.com/sandybrownca/crm/tree/master/src/api/BusinessOperations.Api/Endpoints"
click node_customers "https://github.com/sandybrownca/crm/blob/master/src/api/BusinessOperations.Infrastructure/Customers/CustomerService.cs"
click node_interactions "https://github.com/sandybrownca/crm/blob/master/src/api/BusinessOperations.Infrastructure/Customers/CustomerInteractionService.cs"
click node_invoices "https://github.com/sandybrownca/crm/blob/master/src/api/BusinessOperations.Infrastructure/Invoices/InvoiceService.cs"
click node_payments "https://github.com/sandybrownca/crm/blob/master/src/api/BusinessOperations.Infrastructure/Payment/PaymentService.cs"
click node_dashboard "https://github.com/sandybrownca/crm/blob/master/src/api/BusinessOperations.Infrastructure/Dashboard/DashboardService.cs"
click node_erp "https://github.com/sandybrownca/crm/blob/master/src/api/BusinessOperations.Infrastructure/Erp/ErpSyncService.cs"
click node_erpclient "https://github.com/sandybrownca/crm/blob/master/src/api/BusinessOperations.Infrastructure/Erp/SimulatedErpClient.cs"
click node_auth "https://github.com/sandybrownca/crm/blob/master/src/api/BusinessOperations.Api/Endpoints/AuthEndpoints.cs"
click node_useradmin "https://github.com/sandybrownca/crm/blob/master/src/api/BusinessOperations.Infrastructure/Users/UserAdminService.cs"
click node_dbcontext "https://github.com/sandybrownca/crm/blob/master/src/api/BusinessOperations.Infrastructure/Persistence/AppDbContext.cs"

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_authctx,node_customersui,node_invoicesui,node_dashboardui,node_usersui,node_webapi,node_authapi,node_user toneBlue
class node_endpoints toneAmber
class node_customers,node_interactions,node_invoices,node_payments,node_dashboard,node_erp,node_erpclient toneMint
class node_auth,node_useradmin toneRose
class node_dbcontext,node_sql toneIndigo
```

## Components

### Web application

- [React app routing](https://github.com/sandybrownca/crm/blob/master/src/web/src/App.tsx): `src/web/src/App.tsx`
- [Session context](https://github.com/sandybrownca/crm/blob/master/src/web/src/auth/AuthContext.tsx): `src/web/src/auth/AuthContext.tsx`
- [Customer workspace](https://github.com/sandybrownca/crm/blob/master/src/web/src/pages/CustomersPage.tsx): `src/web/src/pages/CustomersPage.tsx`
- [Invoice workspace](https://github.com/sandybrownca/crm/blob/master/src/web/src/pages/InvoicesPage.tsx): `src/web/src/pages/InvoicesPage.tsx`
- [Dashboard view](https://github.com/sandybrownca/crm/blob/master/src/web/src/pages/DashboardPage.tsx): `src/web/src/pages/DashboardPage.tsx`
- [User workspace](https://github.com/sandybrownca/crm/blob/master/src/web/src/pages/UsersPage.tsx): `src/web/src/pages/UsersPage.tsx`
- [Web API clients](https://github.com/sandybrownca/crm/blob/master/src/web/src/api/client.ts): `src/web/src/api/client.ts`
- [Auth client](https://github.com/sandybrownca/crm/blob/master/src/web/src/api/auth.ts): `src/web/src/api/auth.ts`

### HTTP API

- [Versioned API endpoints](https://github.com/sandybrownca/crm/tree/master/src/api/BusinessOperations.Api/Endpoints): `src/api/BusinessOperations.Api/Endpoints`

### Business operations

- [Customer records](https://github.com/sandybrownca/crm/blob/master/src/api/BusinessOperations.Infrastructure/Customers/CustomerService.cs): `src/api/BusinessOperations.Infrastructure/Customers/CustomerService.cs`
- [Customer interactions](https://github.com/sandybrownca/crm/blob/master/src/api/BusinessOperations.Infrastructure/Customers/CustomerInteractionService.cs): `src/api/BusinessOperations.Infrastructure/Customers/CustomerInteractionService.cs`
- [Invoice lifecycle](https://github.com/sandybrownca/crm/blob/master/src/api/BusinessOperations.Infrastructure/Invoices/InvoiceService.cs): `src/api/BusinessOperations.Infrastructure/Invoices/InvoiceService.cs`
- [Payment processing](https://github.com/sandybrownca/crm/blob/master/src/api/BusinessOperations.Infrastructure/Payment/PaymentService.cs): `src/api/BusinessOperations.Infrastructure/Payment/PaymentService.cs`
- [Business reporting](https://github.com/sandybrownca/crm/blob/master/src/api/BusinessOperations.Infrastructure/Dashboard/DashboardService.cs): `src/api/BusinessOperations.Infrastructure/Dashboard/DashboardService.cs`
- [ERP synchronization](https://github.com/sandybrownca/crm/blob/master/src/api/BusinessOperations.Infrastructure/Erp/ErpSyncService.cs): `src/api/BusinessOperations.Infrastructure/Erp/ErpSyncService.cs`
- [Simulated ERP adapter](https://github.com/sandybrownca/crm/blob/master/src/api/BusinessOperations.Infrastructure/Erp/SimulatedErpClient.cs): `src/api/BusinessOperations.Infrastructure/Erp/SimulatedErpClient.cs`

### Authentication and administration

- [Cookie authentication](https://github.com/sandybrownca/crm/blob/master/src/api/BusinessOperations.Api/Endpoints/AuthEndpoints.cs): `src/api/BusinessOperations.Api/Endpoints/AuthEndpoints.cs`
- [User and role admin](https://github.com/sandybrownca/crm/blob/master/src/api/BusinessOperations.Infrastructure/Users/UserAdminService.cs): `src/api/BusinessOperations.Infrastructure/Users/UserAdminService.cs`

### Persistence

- [EF Core context](https://github.com/sandybrownca/crm/blob/master/src/api/BusinessOperations.Infrastructure/Persistence/AppDbContext.cs): `src/api/BusinessOperations.Infrastructure/Persistence/AppDbContext.cs`
- **SQL Server data**

### Other components

- **CRM user**

## Connections

- CRM user → React app routing: uses (evidence: `src/web/src/App.tsx`)
- React app routing → Session context: provides session (evidence: `src/web/src/App.tsx`)
- React app routing → Customer workspace: routes to (evidence: `src/web/src/App.tsx`)
- React app routing → Invoice workspace: routes to (evidence: `src/web/src/App.tsx`)
- React app routing → Dashboard view: routes to (evidence: `src/web/src/App.tsx`)
- React app routing → User workspace: routes to (evidence: `src/web/src/App.tsx`)
- Session context → Auth client: calls (evidence: `src/web/src/auth/AuthContext.tsx`)
- Customer workspace → Web API clients: requests data (evidence: `src/web/src/pages/CustomersPage.tsx`)
- Invoice workspace → Web API clients: requests data (evidence: `src/web/src/pages/InvoicesPage.tsx`)
- User workspace → Web API clients: requests data (evidence: `src/web/src/pages/UsersPage.tsx`)
- Dashboard view → Web API clients: requests data
- Web API clients → Versioned API endpoints: HTTP requests
- Auth client → Cookie authentication: HTTP requests
- Versioned API endpoints → Customer records: delegates
- Versioned API endpoints → Customer interactions: delegates
- Versioned API endpoints → Invoice lifecycle: delegates
- Versioned API endpoints → Payment processing: delegates
- Versioned API endpoints → Business reporting: delegates
- Versioned API endpoints → ERP synchronization: delegates
- Versioned API endpoints → User and role admin: delegates
- Invoice lifecycle → ERP synchronization: requests sync (evidence: `src/api/BusinessOperations.Infrastructure/Invoices/InvoiceService.cs`)
- ERP synchronization → Simulated ERP adapter: submits invoice (evidence: `src/api/BusinessOperations.Infrastructure/Erp/ErpSyncService.cs`)
- Customer records → EF Core context: reads and writes (evidence: `src/api/BusinessOperations.Infrastructure/Customers/CustomerService.cs`)
- Customer interactions → EF Core context: reads and writes (evidence: `src/api/BusinessOperations.Infrastructure/Customers/CustomerInteractionService.cs`)
- Invoice lifecycle → EF Core context: reads and writes (evidence: `src/api/BusinessOperations.Infrastructure/Invoices/InvoiceService.cs`)
- Payment processing → EF Core context: transactions (evidence: `src/api/BusinessOperations.Infrastructure/Payment/PaymentService.cs`)
- Business reporting → EF Core context: queries (evidence: `src/api/BusinessOperations.Infrastructure/Dashboard/DashboardService.cs`)
- ERP synchronization → EF Core context: reads and writes (evidence: `src/api/BusinessOperations.Infrastructure/Erp/ErpSyncService.cs`)
- User and role admin → EF Core context: manages users
- Cookie authentication → EF Core context: uses identity store
- EF Core context → SQL Server data: persists
