# abhijitsen2923-hub/flexcrm architecture

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

- Interactive diagram: https://gitdiagram.com/abhijitsen2923-hub/flexcrm
- Repository: https://github.com/abhijitsen2923-hub/flexcrm

## Overview

FlexCRM is a multi-tenant CRM with real-estate and finance verticals, plus customer and channel-partner portals. The main staff workflow is authenticated use of the web app to manage leads through pipeline stages and convert sales into customer, booking, and follow-up work; the backend handles requests through services and repositories to tenant data. The README documents additional analytics, HR, integrations, and real-time updates. Sampled code confirms pipeline-stage retrieval and frontend caching; other subsystem links reflect the documented layered architecture and capabilities, not inspection of their implementations.

Main entry points: [`backend/app/api/v1/endpoints`](https://github.com/abhijitsen2923-hub/flexcrm/tree/main/backend/app/api/v1/endpoints) (CRM endpoints), [`backend/app/services`](https://github.com/abhijitsen2923-hub/flexcrm/tree/main/backend/app/services) (CRM services), [`frontend/src/App.tsx`](https://github.com/abhijitsen2923-hub/flexcrm/blob/main/frontend/src/App.tsx) (App and routes), [`frontend/src/pages`](https://github.com/abhijitsen2923-hub/flexcrm/tree/main/frontend/src/pages) (Staff pages)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web application"]
  node_app["App and routes<br/>[App.tsx]"]
  node_staff_pages["Staff pages"]
  node_portal_pages["Portal pages"]
  node_web_services["API services"]
  node_auth_context["Auth context<br/>[AuthContext.tsx]"]
end

subgraph group_crm["CRM workflows"]
  node_crm_endpoints["CRM endpoints"]
  node_crm_services["CRM services"]
  node_repositories["Data repositories"]
  node_pipeline["Pipeline stages<br/>[pipeline_stages.py]"]
  node_pipeline_repo["Pipeline repository<br/>[pipeline_stages.py]"]
  node_crm_data[("CRM tenant data")]
end

subgraph group_verticals["Business verticals"]
  node_real_estate["Real estate"]
  node_finance["Finance"]
  node_hr["HR"]
  node_customer_portal["Customer portal"]
end

subgraph group_platform["Backend platform"]
  node_jobs["Scheduled jobs"]
  node_realtime["Realtime updates<br/>[realtime.py]"]
  node_redis[("Redis cache<br/>[cache.py]")]
end

subgraph group_integrations["Integrations"]
  node_lead_sources["Lead integrations<br/>[lead_ingest.py]"]
  node_external_systems{{"External services"}}
  node_object_store[("S3-compatible storage<br/>[storage.py]")]
end

node_staff(("Staff user"))

node_staff -->|"uses"| node_app
node_app -->|"provides auth"| node_auth_context
node_app -->|"routes to"| node_staff_pages
node_app -->|"routes to"| node_portal_pages
node_staff_pages -->|"requests data"| node_web_services
node_portal_pages -->|"requests data"| node_web_services
node_web_services -->|"HTTP requests"| node_crm_endpoints
node_crm_endpoints -->|"delegates"| node_crm_services
node_crm_services -->|"queries"| node_repositories
node_repositories -->|"reads and writes"| node_crm_data
node_staff_pages -->|"loads stages"| node_pipeline
node_pipeline -->|"lists stages"| node_pipeline_repo
node_pipeline_repo -->|"reads stages"| node_crm_data
node_crm_endpoints -->|"serves vertical APIs"| node_real_estate
node_crm_endpoints -->|"serves vertical APIs"| node_finance
node_crm_endpoints -->|"serves HR APIs"| node_hr
node_crm_endpoints -->|"serves portal APIs"| node_customer_portal
node_crm_services -->|"ingests leads"| node_lead_sources
node_lead_sources -.->|"connects to"| node_external_systems
node_jobs -.->|"syncs with"| node_external_systems
node_crm_services -->|"publishes updates"| node_realtime
node_realtime -->|"streams events"| node_external_systems
node_crm_services -->|"caches data"| node_redis
node_crm_services -->|"stores documents"| node_object_store
node_real_estate -->|"stores documents"| node_object_store
node_finance -->|"stores attachments"| node_object_store

click node_app "https://github.com/abhijitsen2923-hub/flexcrm/blob/main/frontend/src/App.tsx"
click node_staff_pages "https://github.com/abhijitsen2923-hub/flexcrm/tree/main/frontend/src/pages"
click node_portal_pages "https://github.com/abhijitsen2923-hub/flexcrm/tree/main/frontend/src/portals"
click node_web_services "https://github.com/abhijitsen2923-hub/flexcrm/tree/main/frontend/src/services"
click node_auth_context "https://github.com/abhijitsen2923-hub/flexcrm/blob/main/frontend/src/context/AuthContext.tsx"
click node_crm_endpoints "https://github.com/abhijitsen2923-hub/flexcrm/tree/main/backend/app/api/v1/endpoints"
click node_crm_services "https://github.com/abhijitsen2923-hub/flexcrm/tree/main/backend/app/services"
click node_repositories "https://github.com/abhijitsen2923-hub/flexcrm/tree/main/backend/app/repositories"
click node_pipeline "https://github.com/abhijitsen2923-hub/flexcrm/blob/main/backend/app/api/v1/endpoints/pipeline_stages.py"
click node_pipeline_repo "https://github.com/abhijitsen2923-hub/flexcrm/blob/main/backend/app/repositories/pipeline_stages.py"
click node_crm_data "https://github.com/abhijitsen2923-hub/flexcrm/tree/main/backend/app/models"
click node_real_estate "https://github.com/abhijitsen2923-hub/flexcrm/tree/main/backend/app/real_estate"
click node_finance "https://github.com/abhijitsen2923-hub/flexcrm/tree/main/backend/app/finance"
click node_hr "https://github.com/abhijitsen2923-hub/flexcrm/tree/main/backend/app/hr"
click node_customer_portal "https://github.com/abhijitsen2923-hub/flexcrm/tree/main/backend/app/customer_portal"
click node_jobs "https://github.com/abhijitsen2923-hub/flexcrm/tree/main/backend/app/jobs"
click node_realtime "https://github.com/abhijitsen2923-hub/flexcrm/blob/main/backend/app/services/realtime.py"
click node_redis "https://github.com/abhijitsen2923-hub/flexcrm/blob/main/backend/app/core/cache.py"
click node_lead_sources "https://github.com/abhijitsen2923-hub/flexcrm/blob/main/backend/app/services/lead_ingest.py"
click node_object_store "https://github.com/abhijitsen2923-hub/flexcrm/blob/main/backend/app/core/storage.py"

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_staff_pages,node_portal_pages,node_web_services,node_auth_context,node_staff toneBlue
class node_crm_endpoints,node_crm_services,node_repositories,node_pipeline,node_pipeline_repo,node_crm_data toneAmber
class node_real_estate,node_finance,node_hr,node_customer_portal toneMint
class node_jobs,node_realtime,node_redis toneRose
class node_lead_sources,node_external_systems,node_object_store toneIndigo
```

## Components

### Web application

- [App and routes](https://github.com/abhijitsen2923-hub/flexcrm/blob/main/frontend/src/App.tsx): `frontend/src/App.tsx`
- [Staff pages](https://github.com/abhijitsen2923-hub/flexcrm/tree/main/frontend/src/pages): `frontend/src/pages`
- [Portal pages](https://github.com/abhijitsen2923-hub/flexcrm/tree/main/frontend/src/portals): `frontend/src/portals`
- [API services](https://github.com/abhijitsen2923-hub/flexcrm/tree/main/frontend/src/services): `frontend/src/services`
- [Auth context](https://github.com/abhijitsen2923-hub/flexcrm/blob/main/frontend/src/context/AuthContext.tsx): `frontend/src/context/AuthContext.tsx`

### CRM workflows

- [CRM endpoints](https://github.com/abhijitsen2923-hub/flexcrm/tree/main/backend/app/api/v1/endpoints): `backend/app/api/v1/endpoints`
- [CRM services](https://github.com/abhijitsen2923-hub/flexcrm/tree/main/backend/app/services): `backend/app/services`
- [Data repositories](https://github.com/abhijitsen2923-hub/flexcrm/tree/main/backend/app/repositories): `backend/app/repositories`
- [Pipeline stages](https://github.com/abhijitsen2923-hub/flexcrm/blob/main/backend/app/api/v1/endpoints/pipeline_stages.py): `backend/app/api/v1/endpoints/pipeline_stages.py`
- [Pipeline repository](https://github.com/abhijitsen2923-hub/flexcrm/blob/main/backend/app/repositories/pipeline_stages.py): `backend/app/repositories/pipeline_stages.py`
- [CRM tenant data](https://github.com/abhijitsen2923-hub/flexcrm/tree/main/backend/app/models): `backend/app/models`

### Business verticals

- [Real estate](https://github.com/abhijitsen2923-hub/flexcrm/tree/main/backend/app/real_estate): `backend/app/real_estate`
- [Finance](https://github.com/abhijitsen2923-hub/flexcrm/tree/main/backend/app/finance): `backend/app/finance`
- [HR](https://github.com/abhijitsen2923-hub/flexcrm/tree/main/backend/app/hr): `backend/app/hr`
- [Customer portal](https://github.com/abhijitsen2923-hub/flexcrm/tree/main/backend/app/customer_portal): `backend/app/customer_portal`

### Backend platform

- [Scheduled jobs](https://github.com/abhijitsen2923-hub/flexcrm/tree/main/backend/app/jobs): `backend/app/jobs`
- [Realtime updates](https://github.com/abhijitsen2923-hub/flexcrm/blob/main/backend/app/services/realtime.py): `backend/app/services/realtime.py`
- [Redis cache](https://github.com/abhijitsen2923-hub/flexcrm/blob/main/backend/app/core/cache.py): `backend/app/core/cache.py`

### Integrations

- [Lead integrations](https://github.com/abhijitsen2923-hub/flexcrm/blob/main/backend/app/services/lead_ingest.py): `backend/app/services/lead_ingest.py`
- **External services**
- [S3-compatible storage](https://github.com/abhijitsen2923-hub/flexcrm/blob/main/backend/app/core/storage.py): `backend/app/core/storage.py`

### Other components

- **Staff user**

## Connections

- Staff user → App and routes: uses
- App and routes → Auth context: provides auth
- App and routes → Staff pages: routes to
- App and routes → Portal pages: routes to
- Staff pages → API services: requests data
- Portal pages → API services: requests data
- API services → CRM endpoints: HTTP requests
- CRM endpoints → CRM services: delegates
- CRM services → Data repositories: queries
- Data repositories → CRM tenant data: reads and writes
- Staff pages → Pipeline stages: loads stages
- Pipeline stages → Pipeline repository: lists stages
- Pipeline repository → CRM tenant data: reads stages
- CRM endpoints → Real estate: serves vertical APIs
- CRM endpoints → Finance: serves vertical APIs
- CRM endpoints → HR: serves HR APIs
- CRM endpoints → Customer portal: serves portal APIs
- CRM services → Lead integrations: ingests leads
- Lead integrations → External services: connects to
- Scheduled jobs → External services: syncs with
- CRM services → Realtime updates: publishes updates
- Realtime updates → External services: streams events
- CRM services → Redis cache: caches data
- CRM services → S3-compatible storage: stores documents
- Real estate → S3-compatible storage: stores documents
- Finance → S3-compatible storage: stores attachments
