# ghilhermealves/crm architecture

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

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

## Overview

This is a multi-service CRM: users enter through a Next.js interface and an OIDC gateway, then use backend CRM capabilities for sales, customer records, files, analytics, and AI assistance. The graph preserves the README’s major product branches and sampled implementation links. Many backend modules are represented by their exact enclosing directories because their source was not sampled; those relationships are omitted unless documented or evidenced by excerpts.

Main entry points: [`frontend-refine/src`](https://github.com/ghilhermealves/crm/tree/crm-improvements-deploy-phase/frontend-refine/src) (CRM interface), [`auth-service/src/main/java/com/becommerce/auth`](https://github.com/ghilhermealves/crm/tree/crm-improvements-deploy-phase/auth-service/src/main/java/com/becommerce/auth) (OIDC gateway), [`backend/src/main/java/com/becommerce/crm`](https://github.com/ghilhermealves/crm/tree/crm-improvements-deploy-phase/backend/src/main/java/com/becommerce/crm) (CRM API), [`backend/src/main/java/com/becommerce/crm/masterdata/storage/application/service/StorageService.java`](https://github.com/ghilhermealves/crm/blob/crm-improvements-deploy-phase/backend/src/main/java/com/becommerce/crm/masterdata/storage/application/service/StorageService.java) (File storage)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["User experience"]
  node_frontend["CRM interface"]
  node_pipeline_ui["Pipeline interface<br/>[usePipelines.ts]"]
  node_storage_ui["Storage interface<br/>[useStorage.ts]"]
end

subgraph group_identity["Identity and access"]
  node_auth_gateway["OIDC gateway"]
  node_identity_resolution["User resolution"]
end

subgraph group_crm["CRM operations"]
  node_backend["CRM API"]
  node_sales_pipeline["Sales pipeline"]
  node_pipeline_api["Pipeline API"]
  node_storage["File storage"]
  node_omnichannel["Omnichannel messaging"]
  node_billing["Billing"]
end

subgraph group_insights["Insights and automation"]
  node_customer360["Customer 360"]
  node_analytics["Analytics"]
  node_dashboard["Dashboard"]
  node_audit["Audit trail"]
  node_ai_assistant["AI assistant"]
end

node_user(("CRM user"))
node_keycloak["Keycloak"]
node_database[("PostgreSQL")]
node_redis[("Redis")]
node_minio[("MinIO storage")]

node_user -->|"uses"| node_frontend
node_frontend -->|"authenticates through"| node_auth_gateway
node_auth_gateway -->|"uses OIDC"| node_keycloak
node_auth_gateway -->|"relays requests"| node_backend
node_backend -->|"uses"| node_database
node_auth_gateway -.->|"uses rate limiting"| node_redis
node_auth_gateway -->|"resolves users"| node_identity_resolution
node_backend -.->|"serves pipeline routes"| node_pipeline_api
node_pipeline_api -->|"delegates to"| node_sales_pipeline
node_pipeline_ui -.->|"forms sales UI"| node_frontend
node_storage_ui -.->|"uses storage API"| node_backend
node_storage -.->|"stores files"| node_minio
node_storage -->|"records changes"| node_audit
node_sales_pipeline -->|"records changes"| node_audit
node_ai_assistant -->|"builds customer context"| node_customer360
node_frontend -.->|"uses messaging"| node_omnichannel
node_frontend -.->|"uses billing"| node_billing
node_frontend -.->|"views reports"| node_analytics
node_frontend -.->|"views metrics"| node_dashboard

click node_frontend "https://github.com/ghilhermealves/crm/tree/crm-improvements-deploy-phase/frontend-refine/src"
click node_auth_gateway "https://github.com/ghilhermealves/crm/tree/crm-improvements-deploy-phase/auth-service/src/main/java/com/becommerce/auth"
click node_identity_resolution "https://github.com/ghilhermealves/crm/blob/crm-improvements-deploy-phase/auth-service/src/main/java/com/becommerce/auth/application/identity/service/CurrentUserResolutionService.java"
click node_backend "https://github.com/ghilhermealves/crm/tree/crm-improvements-deploy-phase/backend/src/main/java/com/becommerce/crm"
click node_sales_pipeline "https://github.com/ghilhermealves/crm/blob/crm-improvements-deploy-phase/backend/src/main/java/com/becommerce/crm/sales/pipeline/application/service/PipelineService.java"
click node_pipeline_api "https://github.com/ghilhermealves/crm/blob/crm-improvements-deploy-phase/backend/src/main/java/com/becommerce/crm/sales/pipeline/web/PipelineController.java"
click node_pipeline_ui "https://github.com/ghilhermealves/crm/blob/crm-improvements-deploy-phase/frontend-refine/src/features/sales/pipeline/hooks/usePipelines.ts"
click node_storage "https://github.com/ghilhermealves/crm/blob/crm-improvements-deploy-phase/backend/src/main/java/com/becommerce/crm/masterdata/storage/application/service/StorageService.java"
click node_storage_ui "https://github.com/ghilhermealves/crm/blob/crm-improvements-deploy-phase/frontend-refine/src/features/masterdata/storage/hooks/useStorage.ts"
click node_customer360 "https://github.com/ghilhermealves/crm/tree/crm-improvements-deploy-phase/backend/src/main/java/com/becommerce/crm/analytics/customer360"
click node_analytics "https://github.com/ghilhermealves/crm/tree/crm-improvements-deploy-phase/backend/src/main/java/com/becommerce/crm/analytics/reporting"
click node_dashboard "https://github.com/ghilhermealves/crm/tree/crm-improvements-deploy-phase/backend/src/main/java/com/becommerce/crm/analytics/dashboard"
click node_audit "https://github.com/ghilhermealves/crm/blob/crm-improvements-deploy-phase/backend/src/main/java/com/becommerce/crm/analytics/audit/application/service/TenantAuditRecorder.java"
click node_ai_assistant "https://github.com/ghilhermealves/crm/tree/crm-improvements-deploy-phase/backend/src/main/java/com/becommerce/crm/automation/ai/application/service"
click node_omnichannel "https://github.com/ghilhermealves/crm/tree/crm-improvements-deploy-phase/backend/src/main/java/com/becommerce/crm/communication/omnichannel"
click node_billing "https://github.com/ghilhermealves/crm/tree/crm-improvements-deploy-phase/backend/src/main/java/com/becommerce/crm/billing"

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_frontend,node_pipeline_ui,node_storage_ui,node_user toneBlue
class node_auth_gateway,node_identity_resolution,node_database,node_redis,node_minio toneAmber
class node_backend,node_sales_pipeline,node_pipeline_api,node_storage,node_omnichannel,node_billing toneMint
class node_customer360,node_analytics,node_dashboard,node_audit,node_ai_assistant toneRose
class node_keycloak toneIndigo
```

## Components

### User experience

- [CRM interface](https://github.com/ghilhermealves/crm/tree/crm-improvements-deploy-phase/frontend-refine/src): `frontend-refine/src`
- [Pipeline interface](https://github.com/ghilhermealves/crm/blob/crm-improvements-deploy-phase/frontend-refine/src/features/sales/pipeline/hooks/usePipelines.ts): `frontend-refine/src/features/sales/pipeline/hooks/usePipelines.ts`
- [Storage interface](https://github.com/ghilhermealves/crm/blob/crm-improvements-deploy-phase/frontend-refine/src/features/masterdata/storage/hooks/useStorage.ts): `frontend-refine/src/features/masterdata/storage/hooks/useStorage.ts`

### Identity and access

- [OIDC gateway](https://github.com/ghilhermealves/crm/tree/crm-improvements-deploy-phase/auth-service/src/main/java/com/becommerce/auth): `auth-service/src/main/java/com/becommerce/auth`
- [User resolution](https://github.com/ghilhermealves/crm/blob/crm-improvements-deploy-phase/auth-service/src/main/java/com/becommerce/auth/application/identity/service/CurrentUserResolutionService.java): `auth-service/src/main/java/com/becommerce/auth/application/identity/service/CurrentUserResolutionService.java`

### CRM operations

- [CRM API](https://github.com/ghilhermealves/crm/tree/crm-improvements-deploy-phase/backend/src/main/java/com/becommerce/crm): `backend/src/main/java/com/becommerce/crm`
- [Sales pipeline](https://github.com/ghilhermealves/crm/blob/crm-improvements-deploy-phase/backend/src/main/java/com/becommerce/crm/sales/pipeline/application/service/PipelineService.java): `backend/src/main/java/com/becommerce/crm/sales/pipeline/application/service/PipelineService.java`
- [Pipeline API](https://github.com/ghilhermealves/crm/blob/crm-improvements-deploy-phase/backend/src/main/java/com/becommerce/crm/sales/pipeline/web/PipelineController.java): `backend/src/main/java/com/becommerce/crm/sales/pipeline/web/PipelineController.java`
- [File storage](https://github.com/ghilhermealves/crm/blob/crm-improvements-deploy-phase/backend/src/main/java/com/becommerce/crm/masterdata/storage/application/service/StorageService.java): `backend/src/main/java/com/becommerce/crm/masterdata/storage/application/service/StorageService.java`
- [Omnichannel messaging](https://github.com/ghilhermealves/crm/tree/crm-improvements-deploy-phase/backend/src/main/java/com/becommerce/crm/communication/omnichannel): `backend/src/main/java/com/becommerce/crm/communication/omnichannel`
- [Billing](https://github.com/ghilhermealves/crm/tree/crm-improvements-deploy-phase/backend/src/main/java/com/becommerce/crm/billing): `backend/src/main/java/com/becommerce/crm/billing`

### Insights and automation

- [Customer 360](https://github.com/ghilhermealves/crm/tree/crm-improvements-deploy-phase/backend/src/main/java/com/becommerce/crm/analytics/customer360): `backend/src/main/java/com/becommerce/crm/analytics/customer360`
- [Analytics](https://github.com/ghilhermealves/crm/tree/crm-improvements-deploy-phase/backend/src/main/java/com/becommerce/crm/analytics/reporting): `backend/src/main/java/com/becommerce/crm/analytics/reporting`
- [Dashboard](https://github.com/ghilhermealves/crm/tree/crm-improvements-deploy-phase/backend/src/main/java/com/becommerce/crm/analytics/dashboard): `backend/src/main/java/com/becommerce/crm/analytics/dashboard`
- [Audit trail](https://github.com/ghilhermealves/crm/blob/crm-improvements-deploy-phase/backend/src/main/java/com/becommerce/crm/analytics/audit/application/service/TenantAuditRecorder.java): `backend/src/main/java/com/becommerce/crm/analytics/audit/application/service/TenantAuditRecorder.java`
- [AI assistant](https://github.com/ghilhermealves/crm/tree/crm-improvements-deploy-phase/backend/src/main/java/com/becommerce/crm/automation/ai/application/service): `backend/src/main/java/com/becommerce/crm/automation/ai/application/service`

### Other components

- **CRM user**
- **Keycloak**
- **PostgreSQL**
- **Redis**
- **MinIO storage**

## Connections

- CRM user → CRM interface: uses
- CRM interface → OIDC gateway: authenticates through
- OIDC gateway → Keycloak: uses OIDC
- OIDC gateway → CRM API: relays requests
- CRM API → PostgreSQL: uses
- OIDC gateway → Redis: uses rate limiting
- OIDC gateway → User resolution: resolves users (evidence: `auth-service/src/main/java/com/becommerce/auth/application/gateway/service/GatewayOidcService.java`)
- CRM API → Pipeline API: serves pipeline routes (evidence: `backend/src/main/java/com/becommerce/crm/sales/pipeline/web/PipelineController.java`)
- Pipeline API → Sales pipeline: delegates to (evidence: `backend/src/main/java/com/becommerce/crm/sales/pipeline/web/PipelineController.java`)
- Pipeline interface → CRM interface: forms sales UI (evidence: `frontend-refine/src/features/sales/pipeline/hooks/usePipelines.ts`)
- Storage interface → CRM API: uses storage API
- File storage → MinIO storage: stores files
- File storage → Audit trail: records changes (evidence: `backend/src/main/java/com/becommerce/crm/masterdata/storage/application/service/StorageService.java`)
- Sales pipeline → Audit trail: records changes (evidence: `backend/src/main/java/com/becommerce/crm/sales/pipeline/application/service/PipelineService.java`)
- AI assistant → Customer 360: builds customer context (evidence: `backend/src/main/java/com/becommerce/crm/automation/ai/application/service/AiContextualAnalysisService.java`)
- CRM interface → Omnichannel messaging: uses messaging
- CRM interface → Billing: uses billing
- CRM interface → Analytics: views reports
- CRM interface → Dashboard: views metrics
